ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checkbox control on userform (https://www.excelbanter.com/excel-programming/347250-checkbox-control-userform.html)

Kent McPherson

Checkbox control on userform
 
I have a userform with several checkbox controls on it. The intent is for
the user to check which worksheets in the workbook should be visible. I
have a button on the userform that is intended to execute code that reads
the current status of each checkbox control and then make the appropriate
worksheets visible. A piece of that code looks like:

If userform1.checkbox1.Value = True Then
Worksheets("Sheet1").Visible = True
Endif

But I don't seem to be reading the value of the checkbox. Is it not enough
to use the userform1.checkbox1.Value in a statement?




Gary Keramidas

Checkbox control on userform
 
did you try:
If Me.checkbox1.Value = True Then

--


Gary


"Kent McPherson" wrote in message
...
I have a userform with several checkbox controls on it. The intent is for
the user to check which worksheets in the workbook should be visible. I
have a button on the userform that is intended to execute code that reads
the current status of each checkbox control and then make the appropriate
worksheets visible. A piece of that code looks like:

If userform1.checkbox1.Value = True Then
Worksheets("Sheet1").Visible = True
Endif

But I don't seem to be reading the value of the checkbox. Is it not
enough to use the userform1.checkbox1.Value in a statement?






Nigel

Checkbox control on userform
 
I assume the code is in the userform? If it is then it might be that
hiding the worksheet if the checkbox is not set...... try.......

If UserForm1.CheckBox1.Value = True Then
Worksheets("Sheet1").Visible = True
Else
Worksheets("Sheet1").Visible = False
End If

--
Cheers
Nigel



"Kent McPherson" wrote in message
...
I have a userform with several checkbox controls on it. The intent is for
the user to check which worksheets in the workbook should be visible. I
have a button on the userform that is intended to execute code that reads
the current status of each checkbox control and then make the appropriate
worksheets visible. A piece of that code looks like:

If userform1.checkbox1.Value = True Then
Worksheets("Sheet1").Visible = True
Endif

But I don't seem to be reading the value of the checkbox. Is it not

enough
to use the userform1.checkbox1.Value in a statement?







All times are GMT +1. The time now is 10:00 AM.

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