ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   passing a parameter to an excel macro from a form control (https://www.excelbanter.com/excel-programming/400825-passing-parameter-excel-macro-form-control.html)

Sian

passing a parameter to an excel macro from a form control
 
Has anyone managed to pass a parameter to a macro from a form checkbox using
'Assign Macros'?
Alternatively, can I reference the control that called the macro in the
macro code, without knowing its name? (as in 'me.' or something like that)
I want several controls to run the same macro passing it one parameter.
Size limitations (plus sloppy design!) precluse me from repeating the macro.
I much prefer to use form controls in this instance as I'm copying them
programmatically.

Matthew Pfluger

passing a parameter to an excel macro from a form control
 
If it is really necessary to use a Form checkbox instead of a Controls check
box (which would allow you to use its properties), you could make an
intermediate macro. Instead of having the checkbox call the macro that needs
a parameter, write a quick macro that calls the other macro and passes a
parameter to it. This would also allow you to reference the control (or the
macro) that called the main macro.

HTH,
Matthew Pfluger

"Sian" wrote:

Has anyone managed to pass a parameter to a macro from a form checkbox using
'Assign Macros'?
Alternatively, can I reference the control that called the macro in the
macro code, without knowing its name? (as in 'me.' or something like that)
I want several controls to run the same macro passing it one parameter.
Size limitations (plus sloppy design!) precluse me from repeating the macro.
I much prefer to use form controls in this instance as I'm copying them
programmatically.


Sian

passing a parameter to an excel macro from a form control
 
Thank you Matthew, that was helpful - that did occur to me but I thought I
might be missing something. I think I'll find another approach altogether...!


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

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