+ Reply to Thread
Results 1 to 6 of 6

Check all checkboxes on userform

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Check all checkboxes on userform

    Hello everyone
    I have a userform with many checkboxes on it .. and there is a check box named "btnSelectAll"
    I put this code in userform code to check all checkboxes in one shot
    Please Login or Register  to view this content.
    How can I deselect all with the same check box named "btnSelectAll"
    I appreciate any help
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Check all checkboxes on userform

    Thanks a lot
    I could solve it
    Please Login or Register  to view this content.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Check all checkboxes on userform

    You don't need to branch

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Check all checkboxes on userform

    Thank you very much Mr. Mike for sharing this useful and wonderful information
    Kind Regards

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Check all checkboxes on userform

    It looks like you are wanting a checkbox that will drive some other check boxes.
    That got me thinking that if one checked the Master box, all the subordinates would become checked.
    But if the user then unchecked one of the subordinates, that would make the Master out of synch with the situation.

    So I came up with this.
    In the attached, if the user checks cbxVegitables (the master checkbox), then cbxLettuce, cbxBroccoli and cbxCarrots (the subordinates) will all be checked.
    If the user then un-checks cbxBroccoli, the subordinate checkboxes will not be the same and cbxVegitables will show Null rather than checked or unchecked. If the user un-checks all of the subordinates, the the Master will change from Null to unchecked.

    Similarly with the master checkbox, cbxFruit and its subordinates Apples, Banana, Grapes and Oranges.

    And it is expandable. cbxProduce is master to the subordinates cbxFruit and cbxVegitables.

    This uses Class modules and the Intialize event shows how to set-up the master/subordinate relationships.

    I hope this helps your project.

    Each of the checkboxes can be accessed as usual with event code in the Userform module. BUT, one has to account for the possibility that a master checkbox might have a null value, with code like this. Bottom level subordinate checkboxes are normal and not triple-state (unless set so by you)
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mikerickson; 01-14-2016 at 10:29 PM.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Check all checkboxes on userform

    Thank you very much for this wonderful gift
    It would be very useful indeed ..
    Thanks a lot Mr. Mikerickson for all this great help
    Regards

+ 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. VBA Userform: Warn user if all checkboxes on a userform are unticked.
    By MrMiyagi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2014, 12:08 AM
  2. Macro code to check if all checkboxes on userform are false
    By WilliamWu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2013, 03:33 PM
  3. Print Sheets based on checkboxes in UserForm, Checkboxes also control another macro
    By krackaberr in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 03-05-2013, 11:12 AM
  4. [SOLVED] Check all checkboxes
    By Colhawk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2012, 10:45 AM
  5. [SOLVED] VBA code - unable to check checkboxes (userform) in Excel 2010
    By mat418pic in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 02:59 PM
  6. Check/Uncheck all checkboxes
    By JChandler22 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-23-2007, 03:03 PM
  7. [SOLVED] How do I set Checkboxes where you can only check yes or no, not bo
    By Paula in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2006, 07:20 PM
  8. [SOLVED] How do I check/uncheck ten or odd Checkboxes by click on one check
    By Ken Vo in forum Excel General
    Replies: 5
    Last Post: 01-04-2006, 07:15 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