Adding code to new excel sheet dynamically

六眼飞鱼酱① 提交于 2019-11-30 20:45:29
Peter Albert

Instead of trying to create the individual code for each new worksheet with the Visual Basic Extensibility (see this link for further reading), simply use the Workbook wide event Workbook_SheetChange (you need to place it in the ThisWorkbookmodule).

In this event code first check, if the worksheet which caused the event is one of the newly created worksheets. This can be done most easily, be checking the .Name of the worksheet.

didierdrogod

you can use SelectionChange Event and Change event or it is also possible to use the event Thisworkbook module. SheetChange or SheetSelectionChange.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!