Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c As Object
If Not Intersect(Target, Range("A4")) Is Nothing Then
For Each c In ActiveSheet.OLEObjects
If InStr(1, c.Name, "CheckBox") > 0 Then
c.Object.Value = False
End If
Next
End If
End Sub
Sub ClrFromControl()
Call ClearFormControlCheckBoxesInRange(ActiveSheet.[F3:F5])
End Sub
'---------------------------------
'Manip sur Contrôles de formulaire
'---------------------------------
Sub ClearFormControlCheckBoxesInRange(Rng As Range)
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
'La Shape est un Form Control
If Shp.Type = msoFormControl Then
'La Shape est une CheckBox
If Shp.FormControlType = xlCheckBox Then
'La Shape est dans le Range demandé
If Not Intersect(Rng, Shp.TopLeftCell) Is Nothing Then
Shp.OLEFormat.Object.Value = xlOff
End If
End If
End If
Next
End Sub
Sub ClrActiveXControl()
Call ClearActiveXControlCheckBoxesInRange(ActiveSheet.[D3:D5])
End Sub
'---------------------------
'Manip sur Contrôles ActiveX
'---------------------------
Sub ClearActiveXControlCheckBoxesInRange(Rng As Range)
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
'La Shape est un ActiveX Control
If Shp.Type = msoOLEControlObject Then
'La Shape est une CheckBox
If TypeName(Shp.OLEFormat.Object.Object) = "CheckBox" Then
'La Shape est dans le Range demandé
If Not Intersect(Rng, Shp.TopLeftCell) Is Nothing Then
Shp.OLEFormat.Object.Object.Value = False
End If
End If
End If
Next
End Sub