Macro run

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to make a macro run when I click on a specific worksheet?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top