• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Delete Check Box

aambrose19

New Member
Hello.

I added 2columns in which I orginally wanted check boxes in. I created one check box and dragged it down 1200 rows in each column. I now need to delete the boxes and no matter what I do, I cannot get rid of them entirely. It will delete all but the two original check boxes I inserted.

Any help would be greatly appreciated!!!
Thank you.
 
Hi, aambrose19!

Try this code:

Code:
Option Explicit
 
Sub RemoveControls()
    ' constants
    Const ksPattern = "CheckBox*"
    ' declarations
    Dim I As Long
    ' start
    ' process
    With ActiveSheet
        For I = .OLEObjects.Count To 1 Step -1
            With .OLEObjects(I)
                If .Name Like ksPattern Then .Delete
            End With
        Next I
    End With
    ' end
    Beep
End Sub

Adjust constant ksPattern value accordingly to your control names.

Regards!
 
Hi Ambrose ,

One more possibility - in the Home ribbon , click on Find & Select , click on Go To Special , select Objects ; all the objects will be selected. Press the Del key to delete all of them.

This will work only if you do not have any other objects which you wish to preserve !

Narayan
 
If you have already solved.. then ignore.. :)
and next time.. try
Page Layout > Arrange Group > Selection Pane..
OR Home > editing > Find & Select > Selection Pane..
It will open Selection Pane
EYE's are to toggle between Hide & Unhide..
You can press Ctrl + A to select all object and you can then press Ctrl + Click on the desired two check boxes to Invert select..
Simply Press delete to delete all selected Objects..
Just%20Playing%20with%20all%20the%20New%20features.gif


PS: just playing with all the new features... yahoooo...
 
@Debraj... Roy?
Hi, buddy!
Nice to read you again, sharp and clever as usual. Useful tip, I chose VBA because of the 1200 rows, eyes will got crossed using eyes feature :p
Regards!
 
Back
Top