+ Reply to Thread
Results 1 to 6 of 6

Limit number of checkboxes on Excel Worksheet

  1. #1
    Registered User
    Join Date
    05-28-2014
    Posts
    10

    Limit number of checkboxes on Excel Worksheet

    All thanks for your help in advance. I am trying to limit the number of checkboxes a user can select on a worksheet. I have 109 checkboxes total and of those I would like there is a group of 10 (Group1) and within those 10 I want a user to be able to select up to 4.

    The checkboxes are not on a USERFORM. They are activeX boxes directly on a worksheet. I have tried many ways and cannot figure this out.

    Any help would be be greatly appreciated.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Limit number of checkboxes on Excel Worksheet

    I can think of two ways to do this.

    1) Link each checkbox to a cell, then have a cell with an error message that uses a formula to implement the rule you want to enforce. However, this will not prevent them from clicking a box, just notify them if they click too many.

    2) Use macros

    To get a more detailed solution that is specific to your problem please attach your file. The paper clip icon does not work for attachments. Instead, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    05-28-2014
    Posts
    10

    Re: Limit number of checkboxes on Excel Worksheet

    Thanks for responding 6StringJazzer.

    I have attached a file that has the checkboxes. Out of the 8 I would like a user to be able to select only up to three options.
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Limit number of checkboxes on Excel Worksheet

    Since you already have code, let's use a code solution.

    You have removed worksheets so now when I try to save the file, Workbook_BeforeSave runs but results in an error because it refers to sheets that don't exist. I had to exit that code to be able to save the file.

    You have existing code that, when a user checks a box, all other boxes become unchecked. What you are asking for requires scrapping all of that. I have replaced it with something else.

    The new code adds a Sub that has the last checked box as its parameter. It counts the number of checked boxes. If it is more than 3, then it unchecks the last checked box. Each Click event handler calls this Sub if the box is checked.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-28-2014
    Posts
    10

    Re: Limit number of checkboxes on Excel Worksheet

    6StringJazzer thanks so much! You're awesome, exactly what I needed!


  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Limit number of checkboxes on Excel Worksheet

    You're welcome! Thanks for the rep, and thanks for marking your thread Solved!

+ 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. [SOLVED] Is there a way to limit my For Loop to only run on selected CheckBoxes?
    By xlBunny in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-18-2015, 11:49 AM
  2. How do i limit the amount of checkboxes that can be ticked?
    By 10121730 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2012, 12:58 PM
  3. excel row number limit
    By mihai_gros in forum Excel General
    Replies: 3
    Last Post: 01-11-2007, 05:36 AM
  4. [SOLVED] is there a limit to the number of rows a worksheet can have?
    By Debi in forum Excel General
    Replies: 2
    Last Post: 05-22-2006, 09:50 AM
  5. Replies: 4
    Last Post: 12-08-2005, 02:25 PM
  6. Excel Worksheet Limit
    By Ef Dublio in forum Excel General
    Replies: 1
    Last Post: 05-18-2005, 07:06 AM

Tags for this Thread

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