I have created a UF reading in various tabs (opt) with each tab having between 10 to 19 entries which I display in a Multipage checkbox list. Now I'm trying to create various Togglebuttons which uncheck certain checkboxes. I.e. Togglebutton "outside" should uncheck all the inside activities which have been selected from the list. (Like a quick selector).
I have created the checkboxes like this:
For opt = 3 To Sheets.Count
lastRow = Sheets(opt).Cells(Rows.Count, 4).End(xlUp).row
'loop for all options
For i = 1 To lastRow - 1
Set cb = MultiPage1.Pages(opt - 3).Controls.Add("Forms.CheckBox.1", "CheckBox_" & opt & "_1_" & i)
So each CB has a specific name.
I want to uncheck a certain CB (i.e. CheckBox_14_1_18 = False); however, since I wrote the code for the Togglebutton into a (separate) Module, I now struggle to call that specific CB by name/reference.
I've tried:
Dim CBname As String
lastRow = Sheets(Sheets.Count).Cells(Rows.Count, 4).End(xlUp).row
CBname = "CheckBox_" & Sheets.Count & "_1_" & lastRow
' CBname.Value = False --> invalid qualifier
' Me.Controls(CBname).Value = False --> Method or data member not found
How would I call the specific checkbox in the module?