ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   An easy one! (https://www.excelbanter.com/excel-programming/288375-easy-one.html)

Dr. Schwartz[_3_]

An easy one!
 
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


Bob Phillips[_6_]

An easy one!
 
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" wrote in message
...
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




Andy

An easy one!
 
This file might be a help:
http://www.bygsoftware.com/examples/...s/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" wrote in message
...
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





All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com