I have a spreadsheet template that is sent out to customers. Since it is sent to a third party, the spreadsheet cannot have any macros in it. What I would like to accomplish is once the spreadsheet is sent back to me, have the ability to tie a macro I wrote to double clicking a cell in the returned spreadsheet (the macro is stored in a separate spreadsheet I have). Is it possible to have one spreadsheet watch events on another open spreadsheet?
我有一个电子表格模板发送给客户。由于它被发送到第三方,电子表格中不能包含任何宏。我想要完成的是,一旦电子表格被发回给我,就可以将我编写的宏绑定到双击返回的电子表格中的单元格(宏存储在一个单独的电子表格中)。是否可能在另一个打开的电子表格上有一个电子表格表事件?
1 个解决方案
#1
1
In a standard code module:
在标准代码模块中:
Public mySheetClass as new CustomSheet
Public Sub Init()
Set mySheetClass.mySheet = NonMacroWorkbook.WorkSheets("TheSheet")
End Sub
In a class module, named CustomSheet:
在一个名为CustomSheet的类模块中:
Public WithEvents mySheet As Worksheet
Private Sub mySheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
MsgBox "Foo"
End Sub
Then run Init.
然后运行Init。
#1
1
In a standard code module:
在标准代码模块中:
Public mySheetClass as new CustomSheet
Public Sub Init()
Set mySheetClass.mySheet = NonMacroWorkbook.WorkSheets("TheSheet")
End Sub
In a class module, named CustomSheet:
在一个名为CustomSheet的类模块中:
Public WithEvents mySheet As Worksheet
Private Sub mySheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
MsgBox "Foo"
End Sub
Then run Init.
然后运行Init。