From your code, I inferred that there would be multiple sheets with the same structure and functionality, and therefore the same code. So it doesn't make sense to copy the code to each sheet. In such cases, you use workbook-level events (in the ThisWorkbook module). In your case, these will be 3 events: Workbook_SheetCalculate, ..._SheetChange, ..._SheetSelectionChange. If you don't foresee other sheets in the workbook that deviate from the structure of the sheet you presented, you can transfer the bodies of these procedures to the corresponding events in ThisWorkbook. Two auxiliary procedures: AutoFilter_Example1 and Sort_Tabs_Alphabetically, should be placed in a standard module, such as Module1. One event - ..._SheetCalculate - should be slightly modified so that it does not execute too often
Since a change in one sheet can cause another sheet to recalculate as well, I added a condition so that the _Calulate event executes only in the active sheet. Because, in this case, it makes no sense for other sheets. You replace the Me keyword with the Sh variable and add a condition for when the procedure body should execute.
After the code is moved, the code must be removed from the Sheet1 module, otherwise the events will execute twice. Once in the Sheet1 module and a second time in the Thisworkbook module.
Artik
Bookmarks