I am running periodically into an error: Run-time error '-2147352567 (80020009)' The index into the specified collection is out of bounds.
This error is thrown on the line
For Each cb In wks.Shapes
Here is the full code:
Sub SelectAll(wks As Worksheet)
Application.ScreenUpdating = False
Dim cb As Shape
'Loop through Checkboxes
For Each cb In wks.Shapes
If cb.Type = msoFormControl Then
If cb.FormControlType = xlCheckBox Then
cb.OLEFormat.Object.Value = xlOn
With cb.OLEFormat.Object
Application.Run .OnAction, .Name
End With
End If
End If
Next cb
Application.ScreenUpdating = True
End Sub
Aucun commentaire:
Enregistrer un commentaire