global change on form

macamarr

Board Regular
Joined
Nov 1, 2002
Messages
52
Hello,
My form has 10 records and what I am attempting to do is
make a global change using a button or what ever it takes
to make this work. Below is the code I use to clear all
checkboxes on the form. My problem is that I have to do
this for each record. Is there a way I can do this with
one click for every record on the form? Thanks!

Private Sub cmdClear_Click()
S.Value = False
M.Value = False
T.Value = False
W.Value = False
R.Value = False
F.Value = False
Sa.Value = False
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
You can use code like this. The second sub event allows you to toggle all the checkboxes on and off, which might also be useful:-

Code:
Private Sub cmdClear_Click()
Dim ctl As Control

For Each ctl In Me.Controls
    If TypeOf ctl Is CheckBox Then
        ctl.Value = False
    End If
Next ctl

End Sub

Private Sub cmdToggle_Click()
Dim ctl As Control

For Each ctl In Me.Controls
    If TypeOf ctl Is CheckBox Then
        ctl.Value = Not ctl.Value
    End If
Next ctl

End Sub
 
Upvote 0

Forum statistics

Threads
1,221,596
Messages
6,160,719
Members
451,666
Latest member
GCS1998

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top