Thread: Macro run
View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

You can tap into the worksheet_activate event.

Rightclick on the worksheet tab that should have this behavior. Select view
code and paste this in:

Option Explicit
Private Sub Worksheet_Activate()
MsgBox "Hi there from: " & Me.Name
End Sub

Now whenever you swap from a different worksheet in the same workbook to this
worksheet, you'll get a message saying "hi".

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

Cheryl wrote:

Is there a way to make a macro run when I click on a specific worksheet?


--

Dave Peterson