Apply the same Worksheet Event to specific sheets

bnichols

New Member
Joined
Dec 28, 2022
Messages
14
Office Version
  1. 365
Platform
  1. MacOS
Hi, im trying to find a way to apply the same Worksheet Change and Worksheet Calculate event to all sheets if If ws.Name Like "Period*". Tried a few methods like adding it to thisworkbook, however with the calculate event, the index match and xlookup formulas in the sheets themselves keep triggering the code in the background, regardless if its active or if the active sheet is Name Like "Period*". The code is decenlty long and the sheets like period are identical and im just trying to avoid copying/pasting the same code 13x if I have to make an edit. Any help is appreciated
 
The worksheet_change() works whenever something changes within a worksheet.

To prevent this from triggering at every change, place this statement at the beginning of your calculate event:
Application.EnableEvents = False

Then at the end of the calculation code, add this statement:
Application.EnableEvents = False
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top