Dialogsheet Checkbox to Select All Checkboxes
I am using a dialogsheet to get user input. The dialogsheet is created at
runtime. The amount of checkboxes on the dialogsheet varies based on how many
tabs are hidden. I would like to have a checkbox on the dialogsheet that
allows users to "select all" checkboxes.
Code Example:
Dim SheetCount As Integer
Dim CurrentSheet As Worksheet
Dim PrintDlg As DialogSheet
Dim cb As CheckBox
Set CurrentSheet = ActiveSheet
Set PrintDlg = ActiveWorkbook.DialogSheets.Add
'some code used to loop and build checkboxes not shown here
If SheetCount < 0 Then
If PrintDlg.Show Then
For Each cb In PrintDlg.CheckBoxes
If cb.Value = xlOn Then
Worksheets(cb.Caption).Visible = True
End If
Next cb
End If
Else
MsgBox "There are no hidden worksheets!"
End If
|