Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If statement syntax to see if Worksheet_Activate code exists


Need syntax for If statement to see if Worksheet_Activate code exists.

For example

If Sheet1.Worksheet_Activate = True Then

Help please. Thank you. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=490438

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If statement syntax to see if Worksheet_Activate code exists


Hello Mike,

Worksheet_Activate() is an event handler that exists for all
Worksheets. To place code into this event, open the VBA editor by
pressing ALT and F8. Activate the Project Explorer window by pressing
ALT and R. Click on the sheet where you want to place your code. On
your right is a the code window. At the top of the window you will see
to drop down boxes. The left will say *(General)* and the other
*(Declarations)*. Click on (General) and you will see *Worksheet*
listed. Click on Worksheet. The other drop down will now show
*Selection Change*. This is the default event. Click on the arrow of
this drop down to see all the events for the worksheet. They are listed
alphbetatically. At the top is *Activate*. Click on this and the
following will appear in the code window...

Private Sub Worksheet_Activate()

End Sub

In between Sub and End Sub you can add BEEP. This will generate an tone
whenever the worksheet is activated. Each worksheet has it's own event
handler.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=490438

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default If statement syntax to see if Worksheet_Activate code exists

i'm not sure if this is what you are looking for, but how about this?

Sub findproctest()
Dim oCodeM As Object
Dim iStart As Long

For Each oCodeM In ThisWorkbook.VBProject.VBComponents
With oCodeM.codemodule
On Error Resume Next
iStart = 0
iStart = .ProcStartLine("worksheet_activate", vbext_pk_Proc)
If iStart < 0 Then
MsgBox "Worksheet_Activate() found in " & oCodeM.Name
End If
End With
Next
End Sub

keizi

"mikeburg" wrote in
message ...

Need syntax for If statement to see if Worksheet_Activate code exists.

For example

If Sheet1.Worksheet_Activate = True Then

Help please. Thank you. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:

http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=490438


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
if statement syntax help OfficeManager Excel Worksheet Functions 6 July 23rd 08 08:09 PM
need help with syntax of if statement Melody Excel Worksheet Functions 3 February 15th 08 05:05 PM
Code to see if Comment Exists wardides[_13_] Excel Programming 6 November 28th 05 08:56 PM
If syntax to test if command button exists mikeburg[_36_] Excel Programming 1 September 30th 05 01:48 AM
Worksheets Exists Code... KimberlyC Excel Programming 3 July 7th 05 09:19 PM


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

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"