Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
每当我在工作簿中创建新工作表时,我都想自动运行宏。以下是我尝试过的:
Private Sub Workbook_NewSheet() Call Macro1 End Sub Sub Macro1() ... ... End Sub
结果什么也没发生。为什么?
我猜你把它们放在错误的地方。
Private Sub Workbook_NewSheet(ByVal Sh as Object) Call Macro1 End Sub
应该放在ThisWorkBook下,而
Sub Macro1() ... ... End Sub
应该放在模块下