I have a workbook with multiple sheets. I want to add macro code to each sheet, that runs (and makes changes to that sheet) when a macro button on the sheet is clicked. Theoretically, then, if I create a copy of one of the sheets, the new copy will contain the same macro code, which will run on THAT sheet when its macro button is clicked.
I could use ThisWorkbook.ActiveSheet to refer to the worksheet itself (in each of the macros), since logically the sheet should be active when its macro button is clicked. But someone COULD run the macro (from within the macro editor) when some OTHER sheet is actually active. So I'd like to find a way to assign a worksheet variable (maybe called ThisSheet) to the worksheet where the macro code that's executing is located. Is there any simple way to do this?
Bookmarks