Need design help with checkboxes and array of values

Galley

Board Regular
Joined
Nov 8, 2012
Messages
64
My user form will have a series of Check Box Form Controls. They will be used for displaying results from a matrix (array) on a separate worksheet. The user will make a selection from a validated list. The list is a document category. For each category, there are several associated departments that must sign off on the document. The user must be able to select additional departments, but may not deselect any pre-selected departments. The pre-selected items will be disabled via VBA.

I am using conditional formatting to indicate one of three states each checkbox may have. I am not using the checkbox's caption, but instead am using the adjacent cell for that purpose. Each checkbox will have an addditonal cell used to store the Enabled state of the checkbox.

The three states are as follows:
Unselected (tan background), Checkbox's linked cell value (G2) is FALSE, Enabled State cell value (H2) is "".
Pre-selected (purple background), Checkbox's linked cell value (G2) is TRUE, Enabled State cell value (H2) is FALSE.
User-selected (green background), Checkbox's linked cell value (G2) is TRUE, Enabled State cell value (H2) is "".

For testing purposes only, I have added two command buttons. Button3 selects the checkbox and disables it. Button4 deselects and re-enables. The code and conditional formatting work as intended.

Code:
Sub Button3_Click()
'Selects the checkbox
ActiveSheet.Range("G2") = True

'Disables the checkbox
Sheets("Sheet1").CheckBoxes("Check Box 1").Enabled = False

ActiveSheet.Range("H2") = False
End Sub

Sub Button4_Click()
'Deselects the checkbox
ActiveSheet.Range("G2") = False

'Re-enables the checkbox
Sheets("Sheet1").CheckBoxes("Check Box 1").Enabled = True

ActiveSheet.Range("H2") = ""
End Sub

So my question is, What is the best way of looping through a series of 20-25 of these checkboxes? As the selection changes in the validated list, so will the associated checkboxes that must be pre-selected and disabled, based on the values in the matrix. I will also need to loop through the selected items and transfer the list to a report. I have an example workbook with the matrix and a single checkbox, but am unable to post attachments.

Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,216,075
Messages
6,128,665
Members
449,462
Latest member
Chislobog

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