hi everyone, i'm trying to make a macro that loops through all of the checkboxes and if a checkbox is unchecked, it loops through all the cells in the column F, if the cell's value equals the checkbox's caption, then hide the entire row. below is the code i used, but the problem is it wouldn't always hide the row with the cell "GR A"

code :
Sub addcheckboxes()




For Each ws In ActiveWorkbook.Worksheets


If ws.Index > 3 Then
ws.Activate


Range("N1").Value = "Groupes"


ActiveSheet.checkboxes.Add(Left:=Range("N2").Left, Top:=Range("N2").Top, Width:=Range("N2").Width, Height:=Range("A1").Height).Select
With Selection
.Caption = "GR A"
End With
ActiveSheet.checkboxes.Add(Left:=Range("N3").Left, Top:=Range("N3").Top, Width:=Range("N3").Width, Height:=Range("A1").Height).Select
With Selection
.Caption = "GR B"
End With
ActiveSheet.checkboxes.Add(Left:=Range("N4").Left, Top:=Range("N4").Top, Width:=Range("N4").Width, Height:=Range("A1").Height).Select
With Selection
.Caption = "GR C"
End With
ActiveSheet.checkboxes.Add(Left:=Range("N5").Left, Top:=Range("N5").Top, Width:=Range("N5").Width, Height:=Range("A1").Height).Select
With Selection
.Caption = "GR D"
End With
ActiveSheet.checkboxes.Add(Left:=Range("N6").Left, Top:=Range("N6").Top, Width:=Range("N6").Width, Height:=Range("A1").Height).Select
With Selection
.Caption = "GR E"
End With
ActiveSheet.checkboxes.Add(Left:=Range("N7").Left, Top:=Range("N7").Top, Width:=Range("N7").Width, Height:=Range("A1").Height).Select
With Selection
.Caption = "GR F"
End With
ActiveSheet.checkboxes.Add(Left:=Range("N8").Left, Top:=Range("N8").Top, Width:=Range("N8").Width, Height:=Range("A1").Height).Select
With Selection
.Caption = "GR G"
End With


End If
Next ws


End Sub


Sub CheckboxLoop()


For Each ws In ActiveWorkbook.Worksheets


If ws.Index > 3 Then
ws.Activate


Dim LR As Long, i As Long
Dim cb As Shape
Application.ScreenUpdating = False




'Loop through Checkboxes
For Each cb In ActiveSheet.Shapes
If cb.Type = msoFormControl Then
If cb.FormControlType = xlCheckBox Then
If cb.ControlFormat.Value = xlOff Then
'Do something if not checked...
With ActiveSheet
LR = .Range("E" & Rows.Count).End(xlUp).Row
For i = 2 To LR
cb.Select
.Rows(i).Hidden = .Range("E" & i).Value = Selection.Characters.Text

Next i
End With
End If
End If
End If
Next cb
End If
Next ws

Application.ScreenUpdating = True
End Sub




thank you in advance