Do A test sheet first.
Enter something in Column A then run this code
Sub AddCheckboxes()
Dim c As Range
Dim CkBx As CheckBox
Dim Rws As Long, Rng As Range
Rws = Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = Range(Cells(1, 1), Cells(Rws, 1))
For Each c In Rng.Cells
c.Select
Set CkBx = ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width, c.Height)
With CkBx
.Caption = ""
.OnAction = "SetToGreen"
End With
Next c
End Sub
Sub SetToGreen()
Dim CkBx As CheckBox
Dim CkRw As Integer
Dim CkRng As String
CkName = Application.Caller
Set CkBx = ActiveSheet.CheckBoxes(CkName)
CkRw = CkBx.TopLeftCell.Row
CkRng = "A" & CStr(CkRw)
If CkBx.Value > 0 Then
Range(CkRng).EntireRow.Interior.Color = vbGreen
Else
Range(CkRng).EntireRow.Interior.ColorIndex = xlNone
End If
End Sub
Bookmarks