ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to reset checkboxes from control tool box? (https://www.excelbanter.com/excel-programming/371198-how-reset-checkboxes-control-tool-box.html)

[email protected]

How to reset checkboxes from control tool box?
 
Hi,
I have 25 checkboxes in one worksheet. I think it would be
covenient to another checkbox to clear all checkboxes. Can someone
show me how to do that?

Thanks

Ivan


stevebriz

How to reset checkboxes from control tool box?
 
Try this:

Private Sub CheckBox26_Click()
' This works as clear all for other checkboxes 1 t0 25
Dim k as integer
If CheckBox26.Value = False Then ' Checkbox26 is the control checkbox
to clear the other 25
For k = 1 To 25 ' check boxes 1 to 25
Me.Controls("Checkbox" & k).Value =' False set all boxes false
Next k
End If
End Sub


Gary Keramidas

How to reset checkboxes from control tool box?
 
steve:

you have a typo, your apostrophe is before False.

--


Gary


"stevebriz" wrote in message
oups.com...
Try this:

Private Sub CheckBox26_Click()
' This works as clear all for other checkboxes 1 t0 25
Dim k as integer
If CheckBox26.Value = False Then ' Checkbox26 is the control checkbox
to clear the other 25
For k = 1 To 25 ' check boxes 1 to 25
Me.Controls("Checkbox" & k).Value =' False set all boxes false
Next k
End If
End Sub




[email protected][_2_]

How to reset checkboxes from control tool box?
 

stevebriz wrote:
Try this:

Private Sub CheckBox26_Click()
' This works as clear all for other checkboxes 1 t0 25
Dim k as integer
If CheckBox26.Value = False Then ' Checkbox26 is the control checkbox
to clear the other 25
For k = 1 To 25 ' check boxes 1 to 25
Me.Controls("Checkbox" & k).Value =' False set all boxes false
Next k
End If
End Sub


Hi Stevebriz,
Thanks a lot for the tip!
I got a syntax error message and this line " Me.Controls("Checkbox" &
k).Value =' False set all boxes false" was highlighted. Do you know
why? Thanks

Ivan


stevebriz

How to reset checkboxes from control tool box?
 
ry I had a typo

replace the line with

Me.Controls("Checkbox" & k).Value = False 'set all boxes false


[email protected][_2_]

How to reset checkboxes from control tool box?
 

stevebriz wrote:
ry I had a typo

replace the line with

Me.Controls("Checkbox" & k).Value = False 'set all boxes false


Thanks again!

Now I got another message: "Compile error: Method or Data member not
found."

Thanks.

Ivan


stevebriz

How to reset checkboxes from control tool box?
 
what is the line is the error on?


[email protected][_2_]

How to reset checkboxes from control tool box?
 

stevebriz wrote:
what is the line is the error on?


It is the line below with ".Controls" being hightlighted.

Me.Controls("Checkbox" & k).Value = False 'set all boxes false

Thanks

Ivan


stevebriz

How to reset checkboxes from control tool box?
 
If you have the code in a command_click -is the command button you are
clicking on the same form as the checkboxes. or
if the code is checkbox26_click then checkbox26 in the same form as
the other 25 checkboxes?


stevebriz

How to reset checkboxes from control tool box?
 
If you have the code in a command_click -is the command button you are
clicking on the same form as the checkboxes. or
if the code is checkbox26_click then checkbox26 in the same form as
the other 25 checkboxes?


[email protected][_2_]

How to reset checkboxes from control tool box?
 

stevebriz wrote:
If you have the code in a command_click -is the command button you are
clicking on the same form as the checkboxes. or
if the code is checkbox26_click then checkbox26 in the same form as
the other 25 checkboxes?


The code is in checkbox26_click. It is the same form as others from
control toolbox.


Ivan


stevebriz

How to reset checkboxes from control tool box?
 

wrote:
stevebriz wrote:
If you have the code in a command_click -is the command button you are
clicking on the same form as the checkboxes. or
if the code is checkbox26_click then checkbox26 in the same form as
the other 25 checkboxes?


The code is in checkbox26_click. It is the same form as others from
control toolbox.


Ivan

If you like you can email me your form and I will have look at it for
you.



All times are GMT +1. The time now is 12:23 AM.

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