Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to run a procedure when a user clicks on a worksheet. The code should
be something like Private Sub workbook_SheetActivate(ByVal Sh As Object) MsgBox Sh.Name End Sub I've tried putting this in a module and underneath the sheets to no avail. Where should I put this code if I want it to run when a worksheet is clicked and active? -- M. Shipp |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() -- --- Regards, Norman "SHIPP" wrote in message ... I want to run a procedure when a user clicks on a worksheet. The code should be something like Private Sub workbook_SheetActivate(ByVal Sh As Object) MsgBox Sh.Name End Sub I've tried putting this in a module and underneath the sheets to no avail. Where should I put this code if I want it to run when a worksheet is clicked and active? -- M. Shipp |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In ThisWorkbook (since it is a workbook event)
-- - K Dales "SHIPP" wrote: I want to run a procedure when a user clicks on a worksheet. The code should be something like Private Sub workbook_SheetActivate(ByVal Sh As Object) MsgBox Sh.Name End Sub I've tried putting this in a module and underneath the sheets to no avail. Where should I put this code if I want it to run when a worksheet is clicked and active? -- M. Shipp |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since you're using the Workbook_ version, put it under ThisWorkbook.
SHIPP wrote: I want to run a procedure when a user clicks on a worksheet. The code should be something like Private Sub workbook_SheetActivate(ByVal Sh As Object) MsgBox Sh.Name End Sub I've tried putting this in a module and underneath the sheets to no avail. Where should I put this code if I want it to run when a worksheet is clicked and active? -- M. Shipp -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi SHIPP,
You need to move the code to the ThisWorkbook module. --- Regards, Norman "SHIPP" wrote in message ... I want to run a procedure when a user clicks on a worksheet. The code should be something like Private Sub workbook_SheetActivate(ByVal Sh As Object) MsgBox Sh.Name End Sub I've tried putting this in a module and underneath the sheets to no avail. Where should I put this code if I want it to run when a worksheet is clicked and active? -- M. Shipp |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You have received several answers, but
For more information on events http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy "SHIPP" wrote in message ... I want to run a procedure when a user clicks on a worksheet. The code should be something like Private Sub workbook_SheetActivate(ByVal Sh As Object) MsgBox Sh.Name End Sub I've tried putting this in a module and underneath the sheets to no avail. Where should I put this code if I want it to run when a worksheet is clicked and active? -- M. Shipp |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cell Activate Event | Excel Programming | |||
Pasting after Workbook Activate event | Excel Programming | |||
Worksheet Activate Event | Excel Programming | |||
Activate sheet event | Excel Programming | |||
Activate event | Excel Programming |