+ Reply to Thread
Results 1 to 5 of 5

Select All or None of Checkboxes using Radio Button

  1. #1
    Registered User
    Join Date
    12-09-2009
    Location
    NY USA
    MS-Off Ver
    Excel 2016 and 2010
    Posts
    27

    Select All or None of Checkboxes using Radio Button

    Hello.

    I'm here to request an assistance on how I can record a vb macro to perform these tasks.

    The excel file is attached.

    I have 5 checkboxes that I would like for them to all be checked or unchecked at the click of a single radio button on the top.

    In addition, I am interested in having it select certain checkboxes only based on which group they're in.

    I am such a newb with VB. I thank you for any assistance. Cheers!

    ADDITIONAL INFORMATION:

    In the example I've provided, I have only 5 checkboxes. In reality, I'm working with a file that has 300+ rows, each with a checkbox. As time goes on, I will need to add extra rows with new checkboxes.

    Can it be programmed so that "All" check boxes react to a command, instead of pointing to a checkbox one by one?
    Attached Files Attached Files
    Last edited by smk224; 07-12-2010 at 03:23 PM. Reason: Additional information Provided

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Select All or None of Checkboxes using Radio Button

    Hello smk224,

    Here are 2 of the macros you wanted. If your groups will be together then you should use a GroupBox for the check boxes. This make coding more simple. Add these macros to a module in your VBA project and then assign them to the Option Buttons.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    12-09-2009
    Location
    NY USA
    MS-Off Ver
    Excel 2016 and 2010
    Posts
    27

    Re: Select All or None of Checkboxes using Radio Button

    Thanks for your prompt help!

    Those macros were exactly what I was looking for.

    However, the groups are not going to be together as it'll be eventually mixed and matched like A,A,B,A,B,B,A,B for example.

    Is there a macro I can use for that?

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

    Re: Select All or None of Checkboxes using Radio Button

    Quote Originally Posted by smk224 View Post
    However, the groups are not going to be together as it'll be eventually mixed and matched like A,A,B,A,B,B,A,B for example.

    Is there a macro I can use for that?
    It can be done. You will just have to be able to tell us how the macro will know which checkboxes belong to A, and which ones belong to B, etc.
    For example will the words "Group A - " be in every checkbox text for A?

    If you can not think of a way for the macro to tell which ones belong to A, then something like this can be written.
    You select all the As and run a macro that saves them all in a hidden sheet. Then a macro can be written that looks on the hidden sheet to see which ones are in Group A. And you attach that macro to your radio button.
    Foxguy

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

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Select All or None of Checkboxes using Radio Button

    Here's some code based on your sample workbook (revised copy attached too):
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Remember what the dormouse said
    Feed your head

+ 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