Can't delete a checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • macxrbest
    New Member
    • Feb 2008
    • 2

    Can't delete a checkbox

    I have checkboxes in a simple spreadsheet being used to check when a cable is terminated. I'm not using any code with the checkboxes. When I added the checkboxes to the spreadsheet, two extra have showed up in the middle of the page and they can't be deleted. I need some vb code to delete either specific checkboxes or all of them.
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by macxrbest
    I have checkboxes in a simple spreadsheet being used to check when a cable is terminated. I'm not using any code with the checkboxes. When I added the checkboxes to the spreadsheet, two extra have showed up in the middle of the page and they can't be deleted. I need some vb code to delete either specific checkboxes or all of them.
    No, just right click on them, so you can select them and then press Delete.

    Also you can set its visible property to false in VBA,

    HTH

    Comment

    • macxrbest
      New Member
      • Feb 2008
      • 2

      #3
      umm, that's my problem, I've been right clicking them and doing a cut, but they're still there. I also do a format control and change the protection so they're not locked. When I right click them again and select cut, they remain and protection is reset to locked.

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        Originally posted by macxrbest
        umm, that's my problem, I've been right clicking them and doing a cut, but they're still there. I also do a format control and change the protection so they're not locked. When I right click them again and select cut, they remain and protection is reset to locked.

        The locked property is set true as default, but it'll only take effect if the whole worksheet is protected. so i think you should un protect it in order to eliminate it.

        Anyway, to delete it with code, you'll have to find out its name. To find the box's name just record a macro. Select it, move it, or do anything with it. then go to the VB editor, there you'll see the code you've recorded, and its name should appear in a line of code like this:

        ActiveSheet.Sha pes("Check Box 1").Select

        its name is "Check Box 1"

        Errase the macro and write something like

        [CODE=vb]sub anything()
        ActiveSheet.Sha pes("Check Box 1").Delete
        end sub[/CODE]

        but using the name you've just obtained.
        then press F5 while the text cursor is on any of those 3 lines to run the code (or run it from the menu or any method you want to use).

        That should do.

        HTH

        Comment

        Working...