Forum Discussion
Notice SergeiBaklan 's comment! You still need to link each and every box to a cell 4999 times after copying it. The following macro could help out here. It creates 5000 checkboxes with a text label "YES", each linking to its own cell in column B. In this particular example the size of each box is 120 pixels wide by 30 pixels high. The first one will be put at coordinate (0, 0) i.e. top left corner of the sheet. Each following box will be placed 30 pixels below the previous one. If you set the row height to 30 for all rows, it'll work nicely. Of course, you may change the parameters to meet your own needs.
Sub Macro1()
Dim NextLoc, i As Integer
NextLoc = 0
For i = 1 To 5000
ActiveSheet.CheckBoxes.Add(0, NextLoc, 120, 30).Select
With Selection
.Value = xlOff
.Characters.Text = "YES"
.LinkedCell = "$B$" & i
.Display3DShading = False
End With
NextLoc = NextLoc + 30
Next i
End Sub
Dear sir, for the uses of my questinnaire , I need a second collumn of checkboxes (the questionnaire has two possible answers : APPLY /DOES NOT APPLY. could you please add the second collumn to the macro ? THANK YOU FOR YOUR TIME
- Riny_van_EekelenDec 06, 2023Platinum Contributor
alexpantz67 Sorry, but this is a very old post and since then the macro doesn't seem to work as intended on my system anymore. Furthermore, I've stopped using VBA and wouldn't know how to fix it.