Access same Worksheet_SelectionChange from multiple sheets

kpierce

Board Regular
Joined
Jun 21, 2010
Messages
75
Hello:
I have created a workbook with 5 identical sheets. I am utilizing the following functions:
Worksheet_SelectionChange
Worksheet_Change

Instead of having this VBA code in each sheet, is it possible to put this code in a module and then in the sheet, just tell it to run the function in the module. ie, one copy of the VBA code for the entire workbook.

The issue I am having is, when I update the VBA code, I have to replicate it out to each sheet.

Any advice is greatly appreciated.

Thanks
kpierce
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Alan_P

Well-known Member
Joined
Jul 8, 2014
Messages
596
Hi kpierce,

Looks like you would have to put the code in the "ThisWorkbook" section and use the below Sub types

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)

End Sub

Difficult to know exactly though without seeing the code...

Hope this helps,
Cheers,
Alan.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,719
Messages
5,597,736
Members
414,170
Latest member
Mdm

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
Top