ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   let a sub recognise the name of the button that has been clicked. (https://www.excelbanter.com/excel-discussion-misc-queries/78013-let-sub-recognise-name-button-has-been-clicked.html)

Brotherwarren

let a sub recognise the name of the button that has been clicked.
 
Here's the problem,
I have a map of my classroom as a picture on a worksheet. I have the
pupils in the class represented by shapes, with a macro assigned that
loads a userform containg a textbox.
Each button has its name property set to so it matches the pupil's own
name.

I need to click each button, have the userform load and then set the
textbox's value to the name of the pupil that was clicked.

My question is:
Is it possible to have a sub recognise the Name of the button that was
clicked to run the sub?

Cheers in advance.


Jim Rech

let a sub recognise the name of the button that has been clicked.
 
Application.Caller

should do it.

--
Jim
"Brotherwarren" wrote in message
oups.com...
| Here's the problem,
| I have a map of my classroom as a picture on a worksheet. I have the
| pupils in the class represented by shapes, with a macro assigned that
| loads a userform containg a textbox.
| Each button has its name property set to so it matches the pupil's own
| name.
|
| I need to click each button, have the userform load and then set the
| textbox's value to the name of the pupil that was clicked.
|
| My question is:
| Is it possible to have a sub recognise the Name of the button that was
| clicked to run the sub?
|
| Cheers in advance.
|



Brotherwarren

let a sub recognise the name of the button that has been clicked.
 
That's the kind of advice I like! Nice one, it worked a treat! Thanks
a million Jim.



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

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