how can i call a sub() automatically when someone click on sheet1

S

Saadi

Hi

I have a function, that is to be called when someone click on the sheet1.
can someone tell me how do I do this.

the name of that sub is FindRelatedVal()

Sub FindRelatedVal()
............................
End Sub
 
J

Jimbola

You can attach the function (macro) to the activate worksheet event for sheet
one.
In the visual basic editor click sheet1 on the left explorere window, then
in the code window on the right where the drop down list says declaration
change that to This Workbook, then on the right dropdown lists select
Activate.
Add your code and it should run when you click sheet1.

HTH
 
S

Saadi

It Worked thanks Jimbola.

Jimbola said:
You can attach the function (macro) to the activate worksheet event for sheet
one.
In the visual basic editor click sheet1 on the left explorere window, then
in the code window on the right where the drop down list says declaration
change that to This Workbook, then on the right dropdown lists select
Activate.
Add your code and it should run when you click sheet1.

HTH
 

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