ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Passing CheckBox Value from Click Event to Main Macro (https://www.excelbanter.com/excel-programming/322135-passing-checkbox-value-click-event-main-macro.html)

ExcelMonkey[_190_]

Passing CheckBox Value from Click Event to Main Macro
 
I have a form with 7 check boxes. The seventh is a Select
All with checks 1-6. Upon checking the desired boxes, the
user must press either OK or Cancel. Cancel exits the
sub. OK calls the main macro. I want to be able to pass
my check values (TRUE/FALSE) from my click event into the
main macro. Does this mean I have to pass them to the OK
click event and then once again to the main macro. How do
I do this?

Thanks

Bob Phillips[_6_]

Passing CheckBox Value from Click Event to Main Macro
 
Create a public array and set the items of the array to 1 or 0 depending
whether the checkbox is set or not, from the OK button, and read that array
in your main module.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote in message
...
I have a form with 7 check boxes. The seventh is a Select
All with checks 1-6. Upon checking the desired boxes, the
user must press either OK or Cancel. Cancel exits the
sub. OK calls the main macro. I want to be able to pass
my check values (TRUE/FALSE) from my click event into the
main macro. Does this mean I have to pass them to the OK
click event and then once again to the main macro. How do
I do this?

Thanks




Jim Thomlinson[_3_]

Passing CheckBox Value from Click Event to Main Macro
 
So long a s you only hide the form and do not unload it you will still have
access to the values of the check boxes. In this way you can check the values
of the check boxes right in the main module.

if form1.cbx1.value = true then
...

To use this kind of code though you want to make sure that you use the form
activate event to reset the values of the checkboxes as appropriate...

"ExcelMonkey" wrote:

I have a form with 7 check boxes. The seventh is a Select
All with checks 1-6. Upon checking the desired boxes, the
user must press either OK or Cancel. Cancel exits the
sub. OK calls the main macro. I want to be able to pass
my check values (TRUE/FALSE) from my click event into the
main macro. Does this mean I have to pass them to the OK
click event and then once again to the main macro. How do
I do this?

Thanks



All times are GMT +1. The time now is 05:13 PM.

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