+ Reply to Thread
Results 1 to 15 of 15

Select one checkbox and deselect all for each question

  1. #1
    Registered User
    Join Date
    06-14-2014
    Posts
    7

    Red face Select one checkbox and deselect all for each question

    Dear All Experts,

    I not familiar with the VBA and I want to learn how to to this using checkbox instead option button. I also want to learn how to do macro for each question as well.

    Attached a simple sample file here and hope expert can amend it for my reference in order I can apply it my other file

    Your help will be highly appreciated.

    Thank you very much!!

    Book1.xlsx

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Select one checkbox and deselect all for each question

    Use activeX checkboxes to intercept clic event then, for the first row, you can use this code in sheet1 module
    Please Login or Register  to view this content.
    see attached, but it's a big job to do, otherwise you can see http://www.pcreview.co.uk/forums/sel...-t3515244.html
    Attached Files Attached Files
    Last edited by patel45; 06-14-2014 at 05:53 AM.
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Select one checkbox and deselect all for each question

    Try the code on your Modified Sheet:-
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Select one checkbox and deselect all for each question

    Hi carolyn1221,

    Welcome to the forum!!

    In future please make sure you provide a link to any other forum you have cross-posted as this link does. Failure to do so is in breach of Rule 8 (refer here) of the forum rules and can potentially waste someone's time where your request has been already answered in another forum, as has happened to me.

    Thanks,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Select one checkbox and deselect all for each question

    Quote Originally Posted by MickG View Post
    Try the code on your Modified Sheet:-
    Good solution Mick, I suggest this code to create checkboxes and subs automatically
    Please Login or Register  to view this content.

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

    Re: Select one checkbox and deselect all for each question

    You can assign this macro to all of the checkboxes.
    There is no need for one sub per forms check box.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Select one checkbox and deselect all for each question

    Great !!! my compliments !

  8. #8
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Select one checkbox and deselect all for each question

    mikerickson, Thank you for that. That's excellent
    After finding out how to assign the macro to each checkbox, I'm a bit wiser !!!!

  9. #9
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Select one checkbox and deselect all for each question

    Nice one Mike

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

    Re: Select one checkbox and deselect all for each question

    I prefer to use cells as checkboxes in cases like this. Double click on a cell to check/uncheck the value.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-14-2014
    Posts
    7

    Re: Select one checkbox and deselect all for each question

    Dear Robert,

    Thanks and Noted. I won't do same mistake again.

    Thanks for your info and reminding.

  12. #12
    Registered User
    Join Date
    06-14-2014
    Posts
    7

    Re: Select one checkbox and deselect all for each question

    Dear All Expert,

    Thanks for helping! I will try it and see how to work it!!

    Thank you so much!!

  13. #13
    Registered User
    Join Date
    06-14-2014
    Posts
    7

    Re: Select one checkbox and deselect all for each question

    Dear Mikerickson,

    I don't know why when I apply to my checkboxes after close my file and re-open, it pop up "can't run the macro. The macro may not be available in this workbook or all macros may be disable. May I know how you do it? Can you teach me step by step please!!!!!!!

    Then second I need to assign macro to every checkboxes one by one?If I didn't assign macro it doesn't work!

    Please Helpppppppp!

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

    Re: Select one checkbox and deselect all for each question

    You have to put the macro in the workbook that has the check boxes.

    You do have to assign the macro to each of the check boxes. That is on of the reasons that I prefer the cell-as-checkbox solution in post #10.

    Or you could use Option Buttons instead of checkboxes.

  15. #15
    Registered User
    Join Date
    06-14-2014
    Posts
    7

    Re: Select one checkbox and deselect all for each question

    Dear Mikerickson,

    Thanks and noted.

+ 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. Select one checkbox and deselect all for each question
    By carolyn1221 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2014, 11:00 PM
  2. [SOLVED] Checkbox to deselect another checkbox, shorter code
    By JamesT1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2013, 09:59 AM
  3. Select/Deselect All in Pivot table row
    By j-dawg in forum Excel General
    Replies: 1
    Last Post: 02-25-2009, 11:25 AM
  4. [SOLVED] How to select and deselect rows in Excel
    By Gallant in forum Excel General
    Replies: 2
    Last Post: 07-04-2005, 04:05 PM
  5. [SOLVED] How can I select / deselect columns for printing
    By TomH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2005, 04: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