Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default On activate event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default On activate event



--
---
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default On activate event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default On activate event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default On activate event

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default On activate event

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell Activate Event Steph[_3_] Excel Programming 3 June 29th 05 11:43 PM
Pasting after Workbook Activate event Michael Malinsky[_2_] Excel Programming 2 June 6th 05 08:01 PM
Worksheet Activate Event Jason Excel Programming 1 October 29th 04 10:39 PM
Activate sheet event Mike Fogleman Excel Programming 5 January 18th 04 11:02 PM
Activate event Lynn[_3_] Excel Programming 2 September 13th 03 09:30 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"