Dialogsheet Checkbox to Select All Checkboxes

S

Swami

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top