one macro different buttons

K

Khalil Handal

Hi,

I have lot of textboxes and labels (controls) in a sheet in different
places.
When I click any of them I will go to cell A.
i.e.
Private sub Label1_click()
Range("A1").Select
End sub

and

Private sub Label1_click()
Range("A1").Select
End sub
....
....
....

How can I use only ONE code to all of these lables?
To be more clear: Is there something like:

Private sub Label1_click() , Label2_click , Label3_click()...
Range("A1").Select
End sub

Can any one help?
 
S

Sunil Jayakumar

Hi Khalil.

If you are using "forms", rather than "controls" (Older version of
controls), you should be able to right click on the object (in Design mode),
and "Assign Macro" to it.

If you are using controls, you will see a "View Code" option instead.

This will let you assign the same macro to multiple items.

Hope this helps.

Sunil Jayakumar



Khalil Handal said:
Hi,

I have lot of textboxes and labels (controls) in a sheet in different
places.
When I click any of them I will go to cell A.
i.e.
Private sub Label1_click()
Range("A1").Select
End sub

and

Private sub Label1_click()
Range("A1").Select
End sub
...
...
...

How can I use only ONE code to all of these lables?
To be more clear: Is there something like:

Private sub Label1_click() , Label2_click , Label3_click()...
Range("A1").Select
End sub

Can any one help?
www.ayyoo.com/credit-cards.html
 

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