Reputation: 1039
I want to use VBA to delete all comboboxes in a sheet (form control type not active X)
I have
For Each s In ActiveSheet.Shapes
s.Delete
Next s
The problem is it deletes all my shapes, and I'm having trouble finding the logic just to delete comboboxes (which have different names)
Thanks for any help!
Upvotes: 1
Views: 7864
Reputation: 96753
If the only Forms you have are these comboboxes, then:
Sub qwerty()
Dim s As Shape
For Each s In ActiveSheet.Shapes
If s.Type = 8 Then
s.Delete
End If
Next s
End Sub
Upvotes: 0
Reputation: 166136
With ActiveSheet.DropDowns
Do While .Count > 0
.Item(1).Delete
Loop
End With
or just
activesheet.dropdowns.delete
Upvotes: 8