ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Macro When Specific Sheet Selected (https://www.excelbanter.com/excel-programming/401035-run-macro-when-specific-sheet-selected.html)

Carl

Run Macro When Specific Sheet Selected
 
Can someone tell me the code to run a macro when a specific sheet is first
selected? I need it to have a text box appear momentarily when the user
selects the sheet. Thanks in advance.

Don Guillett

Run Macro When Specific Sheet Selected
 
right click sheet tabview codeleft window select worksheetright window
select activate.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Carl" wrote in message
...
Can someone tell me the code to run a macro when a specific sheet is first
selected? I need it to have a text box appear momentarily when the user
selects the sheet. Thanks in advance.



Nick Hodge[_2_]

Run Macro When Specific Sheet Selected
 
Carl

You can use a Worksheet_Activate() event like so

Private Sub Worksheet_Activate()
MsgBox "You activated sheet " & Me.Name
End Sub

To implement just right click on the sheet tab and select View Code. Paste
in the resulting window and save. Now when you activate that sheet the
msgbox will pop up

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk

UK Excel User Conference In Cambridge
November 28th - December 1st 2007
Register Now @ http://www.exceluserconference.com/UKEUC.html



"Carl" wrote in message
...
Can someone tell me the code to run a macro when a specific sheet is first
selected? I need it to have a text box appear momentarily when the user
selects the sheet. Thanks in advance.



Carl

Run Macro When Specific Sheet Selected
 
Thanks. Worked perfectly!

"Nick Hodge" wrote:

Carl

You can use a Worksheet_Activate() event like so

Private Sub Worksheet_Activate()
MsgBox "You activated sheet " & Me.Name
End Sub

To implement just right click on the sheet tab and select View Code. Paste
in the resulting window and save. Now when you activate that sheet the
msgbox will pop up

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk

UK Excel User Conference In Cambridge
November 28th - December 1st 2007
Register Now @ http://www.exceluserconference.com/UKEUC.html



"Carl" wrote in message
...
Can someone tell me the code to run a macro when a specific sheet is first
selected? I need it to have a text box appear momentarily when the user
selects the sheet. Thanks in advance.




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

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