I have the below macro which helps me create multiple checkboxes in a range and link those checkboxes to specific cells. Here is an example what exactly is happening with the below macro.
The macro ask for a range where I need to put in the checkboxes for ex I enter A5:A20 and then next it asks me to enter a column name to which the checkboxes are linked for ex I enter B then the macro links A5:A20 to B5:B20 respectively.
What I want to achieve is that I enter multiple ranges initially for I enter A5:A20,B5:B10 and then I enter C,D then it should link A5:A20 to C5:C20 and B5:B10 to D5:D10 respectively.
I hope i have provided all inputs. Kindly let me know incase any more input is required.
Thanks in advance.
Dim myBox As CheckBox
Dim myCell As Range
Dim cellRange As String
Dim cboxLabel As String
Dim linkedColumn As String
' Enter range to insert check boxes in i.e. A5:A20
cellRange = InputBox(Prompt:="Cell Range", Title:="Cell Range")
' Enter bound column letter
linkedColumn = InputBox(Prompt:="Linked Column", Title:="Linked Column")
' Enter combobox caption, "" for no caption
cboxLabel = InputBox(Prompt:="Checkbox Label", Title:="Checkbox Label")
For Each myCell In .Range(cellRange).Cells
Set myBox = .Parent.checkboxes.Add(Top:=.Top, Width:=.Width, Left:=.Left, Height:=.Height)
.LinkedCell = linkedColumn & myCell.Row
.Caption = cboxLabel
.Name = "checkbox_" & myCell.Address(0, 0)
.NumberFormat = ";;;"