+ Reply to Thread
Results 1 to 4 of 4

Coding Yes/No option buttons to not allow check boxes or require check boxes

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Coding Yes/No option buttons to not allow check boxes or require check boxes

    As part of a userform, I have several Yes/No option buttons in 12 frames (in all, 12 yes/no questions totaling 24 buttons), followed by another frame containing 9 check boxes. The check boxes are named chk2 thru chk10, numbered consecutively (In a another section of the form, I have chk1, which is not important for my questions here).

    In the last yes/no question, the option buttons are named option12Y and option12N (for yes and no, respectively), and they default is false for both. The end user must select either yes or no to submit the form.

    I would like the following rules:

    If option12Y is true, none of the check boxes 2-10 can be checked. The following code handles this rather well:

    Please Login or Register  to view this content.
    Next rule, if option12N is true, then AT LEAST ONE of the check boxes 2 thru 10 MUST be checked true.

    Here's my code for that:

    Please Login or Register  to view this content.
    Problem #1: I get the error message "At least one of the 9 items must be checked..." when option12Y is true, even though the check boxes are grayed out and not enabled via my first code. Obviously, this message should not appear.

    Prolem #2: When option12N is true, it will let me save even if no check boxes are checked - I don't care if more than 1 is checked, but I can't get it to follow the rule that at least 1 needs checked and the message in the code above displayed.

    Any help on how my code should look to satisfy my 2 rules is greatly appreciated!

    -HeyInKy

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Coding Yes/No option buttons to not allow check boxes or require check boxes

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 08-30-2014 at 04:02 AM. Reason: Trying to fix prob 2

  3. #3
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: Coding Yes/No option buttons to not allow check boxes or require check boxes

    Problem 1 went away and I no longer get the message for option2Y being true. But it did not solve problem 2, as it is still saving the data in the userform even if check boxes 2 thro 10 are not checked.

    Any other thoughts?

    Thanks!

    -HeyInKy

  4. #4
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: Coding Yes/No option buttons to not allow check boxes or require check boxes

    Changing the ("chk" & x) = True (not False!! Duh!) did the trick. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Printing using Option Buttons and Check Boxes
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2012, 05:34 PM
  2. Check boxes and Option buttons
    By Chris Martin in forum Excel General
    Replies: 2
    Last Post: 05-15-2009, 04:21 AM
  3. option buttons or check boxes
    By meandmyindigo via OfficeKB.com in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-07-2006, 08:00 AM
  4. [SOLVED] option buttons/check boxes are shifting
    By Dan in forum Excel General
    Replies: 2
    Last Post: 07-27-2005, 01:06 PM
  5. [SOLVED] Option buttons and check boxes moving
    By Wayman Bell in forum Excel General
    Replies: 3
    Last Post: 02-25-2005, 01:06 PM

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