UNcheck checkboxes in frame control?

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
458
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
This code works for correctly CHECKING all checkboxes within a certain frame (Frame1). But I cannot figure out how to make all the checkboxes change to UNCHECKED when the main checkbox ('chkCheckALL') is unchecked...(?)

Here is the code for checking all checkboxes within Frame1. (I just need it now to UNcheck all checkboxes when chkCheckALL is unchecked. thanks)

VBA Code:
Private Sub chkCheckALL_Click()
Frame1.chkCheckALL.value = True
Dim Ctrl As Control
    For Each Ctrl In Frame1.Controls
        If TypeOf Ctrl Is MSForms.CheckBox Then
            Ctrl.value = True
        End If
    Next
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try . . .

VBA Code:
Private Sub chkCheckALL_Click()
    Dim Ctrl As Control
    For Each Ctrl In Frame1.Controls
        If TypeOf Ctrl Is MSForms.CheckBox Then
            Ctrl.Value = (Me.chkCheckALL.Value = True)
        End If
    Next
End Sub

Hope this helps!
 
Upvote 0
Solution
Try . . .

VBA Code:
Private Sub chkCheckALL_Click()
    Dim Ctrl As Control
    For Each Ctrl In Frame1.Controls
        If TypeOf Ctrl Is MSForms.CheckBox Then
            Ctrl.Value = (Me.chkCheckALL.Value = True)
        End If
    Next
End Sub

Hope this helps!
Yes it did, that works exactly how I needed it to. Thank you very much. (y)
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,603
Members
449,089
Latest member
Motoracer88

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