Calling a macro from Worksheet-->Activate

F

Fatz

Hi-

I have a macro that I want to run when a worksheet is activated.
Problem is I do not know how to call it. When I call a function
(Let's say the name is FUNC1) within a macro I just type FUNC1. I am
attempting the same idea on the macro and am having no success.

I'm sure there is a simple solution to this that I am overlooking.
Can someone please help me fill in the blanks??

Private Sub Worksheet_Activate()

MACRO TO RUN HERE. HOW DO I CODE IT?

End Sub

Thanks!
Chris
 
D

Dave Peterson

Private Sub Worksheet_Activate()
Call MacroToRunHere
End Sub

The Call is actually optional. I like to use it.

But you could use:

Private Sub Worksheet_Activate()
MacroToRunHere
End Sub
 
F

Fatz

Private Sub Worksheet_Activate()
  Call MacroToRunHere
End Sub

The Call is actually optional.  I like to use it.

But you could use:

Private Sub Worksheet_Activate()
  MacroToRunHere
End Sub












--

Dave Peterson- Hide quoted text -

- Show quoted text -

Thanks Dave.

So if the macro is named MACRO1, all I type is MACRO1 and it will fire
when the sheet is activated?

Chris
 
D

Dave Peterson

Maybe...

You could do some things that would cause it to fail. But I bet you wouldn't do
those things!

What happened when you did a simple test?
 

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

Top