lundi 23 août 2021

Check all checkboxes only if condition is met

I have a VBA code that checks/unchecks all checkboxes. However I want the code to check/uncheck only the checkboxes that don't a have 'False' written in them in column E5:E150.

Any help would be appreciated, here is my code :

Sub SelectAllSubSector()

    Dim cBoxSector As CheckBox

    For Each cBoxSector In Worksheets("Input attractivite").CheckBoxes
        If Not Intersect(cBoxSector.TopLeftCell, Range("C5:C150")) Is Nothing Then
            If cBoxSector.Name <> ActiveSheet.CheckBoxes("Check Box 3").Name Then
                cBoxSector.Value = ActiveSheet.CheckBoxes("Check Box 3").Value
            End If
        End If
    Next cBoxSector

End Sub



Aucun commentaire:

Enregistrer un commentaire