ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet Activate (https://www.excelbanter.com/excel-programming/395414-worksheet-activate.html)

Scott

Worksheet Activate
 
I have a sub that needs to fire any time a worksheet activates. I know how
to put the code below "behind" each worksheet, but was wondering if there a
way to place the code in a "Workbook" event so the code would achieve the
same results and execute any time a different sheet gets activated, but only
have to keep it in one place?

I have about 25 worksheets within my workbook and was trying to be more
efficient.

CODE:

Private Sub Worksheet_Activate()
Call mySub
End Sub



Bob Phillips

Worksheet Activate
 
Private Sub Workbook_SheetActivate(ByVal Sh As Object)

End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"scott" wrote in message
...
I have a sub that needs to fire any time a worksheet activates. I know how
to put the code below "behind" each worksheet, but was wondering if there a
way to place the code in a "Workbook" event so the code would achieve the
same results and execute any time a different sheet gets activated, but
only have to keep it in one place?

I have about 25 worksheets within my workbook and was trying to be more
efficient.

CODE:

Private Sub Worksheet_Activate()
Call mySub
End Sub





Scott

Worksheet Activate
 
i just found it, thanks.

"Bob Phillips" wrote in message
...
Private Sub Workbook_SheetActivate(ByVal Sh As Object)

End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"scott" wrote in message
...
I have a sub that needs to fire any time a worksheet activates. I know how
to put the code below "behind" each worksheet, but was wondering if there
a way to place the code in a "Workbook" event so the code would achieve
the same results and execute any time a different sheet gets activated,
but only have to keep it in one place?

I have about 25 worksheets within my workbook and was trying to be more
efficient.

CODE:

Private Sub Worksheet_Activate()
Call mySub
End Sub








All times are GMT +1. The time now is 07:07 AM.

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