+ Reply to Thread
Results 1 to 8 of 8

Event Driven checkbox. Chosing one is erasing the others

  1. #1
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Event Driven checkbox. Chosing one is erasing the others

    This uses the double click marlett checkbox technique.
    In B3, is a "All Options" checkbox. If that is checked, I want individual options to uncheck (that seems to be working)

    In B5:B10 are individual options. If one of those is checked, the All Options (B3) should uncheck but the other options should be independent.

    Problem: Only one of the individual options seems to want to be checked at a time. Here's the code,
    Please Login or Register  to view this content.
    What am I doing wrong?
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Event Driven checkbox. Chosing one is erasing the others

    In your code, when you refer to Target, it is pulling the Value of the Target (which is blank in cell B3, causing excel to fire the ClearContents line of code).

    Try this and let me know if it works:

    Please Login or Register  to view this content.
    Last edited by BigBas; 07-30-2012 at 04:54 PM. Reason: Sorry, deleted a line of code

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Event Driven checkbox. Chosing one is erasing the others

    ChemistB,

    In the code you posted, you have a check for "If Target = Range("$B$3") which means "If the cell you're double-clicking has the same value as B3". So when B3 was blank, and you double-clicked a blank cell to check it, it ran the first if statement which included Range("B5:B10").ClearContents (unchecking those cells) and then it checked the one you actually double-clicked.

    Attached is a modified version of your example workbook. I updated the double-click event code to the following:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: Event Driven checkbox. Chosing one is erasing the others

    That worked BigBas! Thanks

  5. #5
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Event Driven checkbox. Chosing one is erasing the others

    Glad to help a fellow Jerseyan.

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: Event Driven checkbox. Chosing one is erasing the others

    and Thanks TA. It's great to learn new ways to do things. I should have realized that excel would be comparing values not addresses.

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

    Re: Event Driven checkbox. Chosing one is erasing the others

    Another way:
    Please Login or Register  to view this content.
    Last edited by shg; 07-30-2012 at 05:08 PM.
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: Event Driven checkbox. Chosing one is erasing the others

    And thanks to you, shg. Adding all three versions to a spreadsheet for reference.

+ 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