I am trying to create a sheet which will have a checkbox in each non-empty line. To automatically adjust the number of checkboxes I created this macro:
Sub checkboxes()
Dim i As Integer
For i = 9 To 200
Set CurCell = ActiveSheet.Cells(i, 3)
If CurCell.Value > 1 Then
ActiveSheet.Shapes("CheckBox" & CStr(i)).Visible = True
Else
ActiveSheet.Shapes("CheckBox" & CStr(i)).Visible = False
End If
Next i
End Sub
I expect number of potential rows with data not greater than 200. Macro checks if value in column C for each line is >1, if true checkbox is visible, else it's hidden.
My problem is that I don't know how to put the loop counter "i" into Shape name - I got an error using code above. Can someone help?
Check Box 1, so you calling out"Checkbox" & CStr(i)won't find anything, unless you manually changed the names of each checkbox.