TEST ON A SAMPLE OR COPY OF YOUR WORKBOOK
I would add the checkboxes like this for the range I needed them. And make the the checkbox name = "Check box " & the row its in.
Sub test()
Dim cb As CheckBox
For ptr = 2 To 10
Set rng = Cells(ptr, "k")
Set cb = CheckBoxes.Add(rng.Left, rng.Top, rng.Width, rng.Height)
With cb
.Caption = "hello world"
.Name = "Check box " & ptr
'.OnAction = "Macro"
'.Visible = False
End With
Next
End Sub
Then you could hide and unhide them by name. I dnt know the full scope of your project so this is just an idea.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("j2:j10"), Target) Is Nothing Then
If Target.Value > "" Then
Shapes("Check box " & Target.Row).Visible = msoCTrue
Else
Shapes("Check box " & Target.Row).Visible = msoFalse
End If
End If
Set rng = Nothing
End Sub
Bookmarks