+ Reply to Thread
Results 1 to 12 of 12

Combo Box - Enabled and Disabled based on another Combo Box Entry

  1. #1
    Registered User
    Join Date
    03-07-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    10

    Question Combo Box - Enabled and Disabled based on another Combo Box Entry

    I have a 200 row spreadsheet where C2 to C200, all rows have combo boxes. The possible selections within the combo box are "Yes" or "No".

    I want a combo box to be enabled in D2 to D200, only if the corresponding C row value is a "yes". If the value is no, the combo box in D column should be disabled and not available for selection.

    For Example:

    C37 D37
    Yes Combo Box available

    C38 D38
    No No combo box

    What would be the code to satisfy this requirement? Please help.

  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,259

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Hello excelrequired,

    Welcome to the Forum!

    It would be beneficial if you posted your workbook. It will reduce the need for questions and allow any solutions to be fully tested on the actual workbook data.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.
    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
    03-07-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Please find attached the spreadsheet. Do not use Scoring spreadsheet. Please use Marks Spreadsheet.

    I have a 200 row spreadsheet where C2 to C200, all rows have combo boxes. The possible selections within the combo box are "Yes" or "No".

    I want a combo box to be enabled in D2 to D200, only if the corresponding C row value is a "yes". If the value is no, the combo box in D column should be disabled and not available for selection.

    For Example:

    C37 D37
    Yes Combo Box available

    C38 D38
    No Should be No combo box available
    Attached Files Attached Files
    Last edited by excelrequired; 03-08-2014 at 12:06 AM.

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

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Hello excelrequired,

    There is only 1 combo box on the worksheet in cell C2. What are the selections for the combo box that will be in D2?

  5. #5
    Registered User
    Join Date
    03-07-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    My apologies, I uploaded the wrong version.

    Marks.xlsx

    Quote Originally Posted by Leith Ross View Post
    Hello excelrequired,

    There is only 1 combo box on the worksheet in cell C2. What are the selections for the combo box that will be in D2?

  6. #6
    Registered User
    Join Date
    03-07-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Please find attached the spreadsheet. Do not use Scoring spreadsheet. Please use Marks Spreadsheet.

    I have a 200 row spreadsheet where C2 to C200, all rows have combo boxes. The possible selections within the combo box are "Yes" or "No".

    I want a combo box to be enabled in D2 to D200, only if the corresponding C row value is a "yes". If the value is no, the combo box in D column should be disabled and not available for selection.

    For Example:

    C37 D37
    Yes Combo Box available

    C38 D38
    No Should be No combo box available

    Please help me

    Attachment 302812[/QUOTE]

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

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Hello excelrequired,

    The attached workbook contains 2 macros and 1 class. The easiest way to reduce the code needed for all these ComboBoxes is to use a technique called SubClassing. This allows a group on controls to share the same events and properties.

    The macro called AddComboBoxes removes all the existing comboboxes on Sheet1 and replaces them. The comboboxes are are added to column "C" and then to column "D" keeping the names sequential which makes referencing the controls much easier. The macro also sizes the combobox to fit the cell and adds the appropriate ListFillRange. The last row of the grid is determined by the borders of the last cell in column "A". So, if you change the grid size all you need to do is run this macro.

    The main macro subclasses all the comboboxes on Sheet1. This happens when the workbook is first opened. This allows the comboboxes in column "C" to enable or disable the adjacent combobox in column "D" based on combobox "C"'s selection.

    Macro to SubClass the ComboBoxes on Sheet1
    Please Login or Register  to view this content.
    Class Module - MyComboBox
    Please Login or Register  to view this content.
    Macro to Add and Setup ComboBoxes to Sheet1
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-07-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Hi Leith Ross

    I wish I could I understand the code but its amazing what you did! Thank you so much. It works perfectly. Appreciate all your help!

    Thank you again.
    Excelrequired!

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

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Hello excelrequired,

    Thanks, but I found a problem in code. It is not working with all check boxes in column "D'. I am working on correcting it now.

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

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Hello excelrequired,

    Okay, got the problem fixed. Use this workbook. The modified code is below.

    Macro to SubClass ComboBoxes on Sheet1
    Please Login or Register  to view this content.
    Class Module - MyComboBox
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-07-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Thanks Leith. Much appreciated!

  12. #12
    Registered User
    Join Date
    03-07-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Combo Box - Enabled and Disabled based on another Combo Box Entry

    Marks ver 3.zip

    Hi Leith,

    I guess I made an error, I added a new column with combo boxes and the code stopped working I am sure I did something wrong. I attached the spreadsheet with the new column.

    Can you help please.

    Excelrequired

+ 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] Excel 2010 VBA – Combo Box Options– Clear cell/box in 2nd Combo when 1st Combo selected
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2013, 07:25 PM
  2. [SOLVED] Fill combo box list based on other combo box values
    By rain4uu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2013, 03:04 PM
  3. [SOLVED] Combo Box2 selections available based on Combo box 1 selection
    By wishn4fishn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2013, 08:13 PM
  4. combo box input range based on the other combo box selection
    By hedayet in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-08-2013, 02:27 AM
  5. [SOLVED] How to reference a second Combo box’s output based on previous Combo Box’s Row source
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2012, 11:27 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