ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dialogsheet Checkbox to Select All Checkboxes (https://www.excelbanter.com/excel-programming/441488-dialogsheet-checkbox-select-all-checkboxes.html)

swami

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


All times are GMT +1. The time now is 01:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com