An easy one!

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

Guest

I have 16 contol buttons that all launch the same sub. How can I make the code recognise which button was pressed?

Is there a way to rename (not the text) a button differently from what Excel assigns?

Any help is appriciated
Schwartz
 
Dr Schwartz,

I assume that you are either using worksheet control toolbox buttons or
userform buttons (as worksheet Forms button prompt for a macro to be
assigned). In both of these cases, if you double-click the object whilst in
design mode, you will be presented with a skeleton click event module, where
you can add your code.

To rename them, when selected, go into the Properties pane, and change the
name.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Dr. Schwartz said:
I have 16 contol buttons that all launch the same sub. How can I make the
code recognise which button was pressed?
 
This file might be a help:
http://www.bygsoftware.com/examples/zipfiles/apcaller.zip
It's in the "Worksheet with VBA" section on page:
http://www.bygsoftware.com/examples/examples.htm

A short demo that reports which of three buttons was pressed

--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"



Dr. Schwartz said:
I have 16 contol buttons that all launch the same sub. How can I make the
code recognise which button was pressed?
 
Back
Top