Estaba tratando de escribir una macro que borraríatodas las casillas de verificación ActiveX dentro del rango seleccionado. Escribí este código, pero sigue devolviendo el error "El objeto no es compatible con esta propiedad o método". Por favor, ayuda.
Dim cbx As OLEObject
Dim rng As Range
Set rng = selection
For Each cbx In ActiveSheet.OLEObjects
If Not Intersect(rng, cbx.Object.TopLeftCell) Is Nothing Then cbx.Delete
Next
Respuestas
1 para la respuesta № 1If Not Intersect(rng, cbx.TopLeftCell) Is Nothing Then cbx.Delete
1 para la respuesta № 2
Esto eliminará todas las casillas de verificación ActiveX dentro de una selección:
Sub DeleteActiveXCheckboxes()
Dim Shape As Shape
For Each Shape In ActiveSheet.Shapes
If Shape.Type = 12 Then
If Not Intersect(Shape.TopLeftCell, Selection) Is Nothing Then
Shape.Delete
End If
End If
Next Shape
End Sub