ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Worksheet Macros for All Worksheets in a Workbook? (https://www.excelbanter.com/excel-worksheet-functions/112486-worksheet-macros-all-worksheets-workbook.html)

Bob

Worksheet Macros for All Worksheets in a Workbook?
 
Hi,
I have written a group of worksheet macros (things like Private Sub
Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)).
I would like these macros to apply to all sheets in the workbook,
including ones that are addded later. How do I do this?

Thanks,
Andrew


Ron de Bruin

Worksheet Macros for All Worksheets in a Workbook?
 
Hi Bob

There is a Change event for example in each worksheet module but
if you go to the thisworkbook module there is a event called

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

End Sub

This will run on very change in all worksheets


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Bob" wrote in message oups.com...
Hi,
I have written a group of worksheet macros (things like Private Sub
Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)).
I would like these macros to apply to all sheets in the workbook,
including ones that are addded later. How do I do this?

Thanks,
Andrew





All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com