Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to have a macro execute every time a specific Worksheet is
selected. Thank You, Bob carter |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob
Try: '============= Private Sub Worksheet_Activate() Call MyMacro End Sub '<<============= This is worksheet event code and should be pasted into the worksheets's code module (not a standard module and not the workbook's ThisWorkbook module): Right-click the worksheet's tab Select 'View Code' from the menu and paste the code. Alt-F11 to return to Excel. In a standard module: Alt-F11 to open the VBE, Tools | Insert | Module paste the following code: '============= Public Sub MyMacro() 'Your code, e.g.: MsgBox Prompt:="Hi!" End Sub '<<============= --- Regards, Norman "Trebor Retrac" wrote in message ... I would like to have a macro execute every time a specific Worksheet is selected. Thank You, Bob carter |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Norman, the macro does exactly what i wanted.
Bob Carter Douglas, MA USA "Norman Jones" wrote: Hi Bob Try: '============= Private Sub Worksheet_Activate() Call MyMacro End Sub '<<============= This is worksheet event code and should be pasted into the worksheets's code module (not a standard module and not the workbook's ThisWorkbook module): Right-click the worksheet's tab Select 'View Code' from the menu and paste the code. Alt-F11 to return to Excel. In a standard module: Alt-F11 to open the VBE, Tools | Insert | Module paste the following code: '============= Public Sub MyMacro() 'Your code, e.g.: MsgBox Prompt:="Hi!" End Sub '<<============= --- Regards, Norman "Trebor Retrac" wrote in message ... I would like to have a macro execute every time a specific Worksheet is selected. Thank You, Bob carter |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
2Q:Indirect worksheet selection in macro, Calc off for specific sh | Excel Discussion (Misc queries) | |||
How to execute a macro in a protected worksheet? | Excel Programming | |||
Worksheet, selection macro | Excel Worksheet Functions | |||
How to keep ONKey's macro on Worksheet Selection Change Event | Excel Programming | |||
Record Worksheet Content as Macro and Execute from another Worksheet | Excel Programming |