+ Reply to Thread
Results 1 to 4 of 4

Combobox with Data Validation so that same value cannot be selected

  1. #1
    Registered User
    Join Date
    05-03-2008
    Posts
    24

    Combobox with Data Validation so that same value cannot be selected

    Hello

    I have 5 combo boxes in a userform. Each combobox has the same values in the drop down (numbers 1,2,3,4,5,6,7,8). I need to do a data validation such that if the user selects "1" in cboInvestmentList1, then the user cannot select "1" from cboInvestmentList2 through cboInvestmentList5.

    Additionally, I would like an error message to pop up explaning that the value cannot be selected more than once.

    If I were using the excel data validation my equation would look similar to:

    cboInvestmentList1: =cboInvestmentList1<>cboInvestmentList2:cboInvestmentList5

    cboInvestmentList2: =cboInvestmentList2<>cboInvestmentList1,cboInvestmentList3:cboInvestmentList5

    cboInvestmentList3: =cboInvestmentList3<>cboInvestmentList1:cboInvestmentList2,cboInvestmentList4:cboInvestmentList5

    cboInvestmentList4: =cboInvestmentList4<>cboInvestmentList1:cboInvestmentList3,cboInvestmentList5

    cboInvestmentList5: =cboInvestmentList5<>cboInvestmentList1:cboInvestmentList4

    Any help would be appreciated!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Combobox with Data Validation so that same value cannot be selected

    Here's a technique I use for self-diminishing drop down lists to make duplicate choices impossible. Perhaps you can adapt this for your use in the combo boxes.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    05-03-2008
    Posts
    24

    Re: Combobox with Data Validation so that same value cannot be selected

    Thank you, but I am using a userform and I am not sure how to translate the excel function into VB code.

  4. #4
    Registered User
    Join Date
    08-12-2014
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    1

    Re: Combobox with Data Validation so that same value cannot be selected

    Hi guys, got same query, but it seems not solved as of the moment, anyone who can help?

+ 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