The following VBA code snippet should be executed in all open workbooks within a single Excel file (*.xlsm):
Private Sub Worksheet_Change(ByVal Target As Range)
...
End Sub
We do not want to copy the code in each workbook to reduce code duplication.
When trying to create a new Macro via the Excel "Macro" dialog it offers the possibility to locate the Macro in:
- all open workbooks
- this/current workbook
- current file
When choosing (1) in combination with a Macro name, e.g. "MultiSelect" Excel jumps in the VBA editor and scaffolds a basic method according to the given name:
Sub MultiSelect()
...
End Sub
Our question: how to guarantee reacting on "Worksheet_Change" events within this macro?