one macro different buttons

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
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?
 
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
 
Back
Top