question about vbs clearbutton_click

G

GregJG

i have 25 check boxes (cb1:cb25). do i have to code in each check box t
clear when the button is clicked, or is there a code to clear all a
once?

example of what I have now.

cb1.clear
cb2.clear
cb3.clear
ect.....
 
G

GregJG

I have read something like

Worksheets("Sheet1").Range("A1:G37").Clear

but cannot firgure out how to do it in a frame on a form

i have tried

formName.Frame1.clear ' all the boxes are in frame
 
B

Bob Phillips

That clears a cell, not a checkbox.


'-----------------------------------------------------------------
Private Sub ClearCheckboxes()
'-----------------------------------------------------------------
Dim ctl As msforms.Control

For Each ctl In Me.Controls
If TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top