Hi
In my spreadsheet, I have 30 x rows of checkboxes with 12 x checkboxes on each row.
On each row, one checkbox is used as a master control to select / de-select all the other eleven checkboxes. The ‘master’ checkboxes are all logically named from “MasterL01” on Line 1 to “MasterL30” on Line 30
On each line, the other eleven checkboxes are named logically as follows:
Line 1: “L01CB01”, “L01CB02”, “L01CB03” up to “L01CB11”
Line 2: “L02CB01”, “L02CB02”, “L02CB03” up to “L02CB11”
Line 3: “L03CB01”, “L03CB02”, “L03CB03” up to “L03CB11”
etc
To each of the ‘master’ checkboxes I have assigned a macro such as this one, assigned to “MasterL01”:
Sub Master_L01()
‘ This macro is used to select all / deselect all checkboxes on Line 1
ActiveSheet.CheckBoxes("L01CB01").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB02").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB03").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB04").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB05").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB06").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB07").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB08").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB09").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB10").Value = ActiveSheet.CheckBoxes("MasterL01").Value
ActiveSheet.CheckBoxes("L01CB11").Value = ActiveSheet.CheckBoxes("MasterL01").Value
End Sub
As you can see, I am clearly not a programmer(!) and have written this code in a very simplistic, line-by-line fashion. I know there is a better way to write this code – looping through each of the checkboxes – but I have no idea how to do this. Any help, or advice, would be most welcome!
Sample file attached...
Many thanks
Mike
Bookmarks