+ Reply to Thread
Results 1 to 8 of 8

Checkbox won't delete

  1. #1
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Checkbox won't delete

    I'm using this code to delete all checkboxes below a given top.
    Please Login or Register  to view this content.
    No matter what I do, it always leaves one checkbox. It deletes all the others, but always leaves one.
    Last edited by foxguy; 08-24-2010 at 05:01 PM.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Checkbox won't delete

    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Last edited by shg; 08-23-2010 at 07:47 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Checkbox won't delete

    Hi shg;

    I don't want all the checkboxes deleted. Only those that are below a fixed point on the screen. The code I'm using works fine except that there is always one checkbox left below that point.

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Checkbox won't delete

    I found a solution to my problem. I named the checkboxes when I created them with a unique name pattern, then deleted all the checkboxes with that name pattern.
    Please Login or Register  to view this content.
    I'm still interested in finding out why my first code doesn't work.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,289

    Re: Checkbox won't delete

    When you create controls, isn't the first one a count of zero? Have you tried

    for i = 0 to ......

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Checkbox won't delete

    Generally better to loop backwards through a collection when deleting. The need for an error handler is a bit of a giveaway.
    Everyone who confuses correlation and causation ends up dead.

  7. #7
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Checkbox won't delete

    romperstomper; that's probably it. Don't know why I didn't think of it.

    MarvinP - yes I tried from 0 to, didn't make any difference.

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,289

    Re: Checkbox won't delete

    Perhaps it is like hiding pages. You can't hide the last page because then you''d have none? Just a stupid guess. Have you treid the immediate window to see which checkbox is still there? Use the index method to see which it is. Maybe this will give you a clue.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1