+ Reply to Thread
Results 1 to 5 of 5

Questions about dealing with drop down lists - data validation

  1. #1
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Questions about dealing with drop down lists - data validation

    Hello all,

    Another in the "I have never done this before and don't know where to start" series

    data validation and drop down lists?

    I have a worksheet ("Constants") that contains a list of values that I want to reference in another tab via a dropdown list.
    The length of list is constantly changing (adding new customers for example) however I can always calculate the start and the last entry row values for the list if I need to.
    I have a data entry tab with a cell that has the "dropdown list" referenced via data validation. (say cell D3)

    So far so good

    Now my questions,
    q1. can I always start the dropdown list display of options at the start of the range of names available, if so how
    q2. is there a sort of "typeahead" feature that allows me to type a couple of letters and position the display at that point in the list of options.
    q3. I finally select a name from the list and it is then displayed in say cell D3. Is there a "vba does the heavy lifting" option to know which row from the list of customers that the selection was made.

    I am happy to post a work in progress workbook if that will help, I think these are general "how do I do "stuff" questions rather than specific to my workbook

    I hope I have explained my questions adequately

    Jmac1947 (and still learning)
    Last edited by jmac1947; 02-08-2014 at 07:26 AM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Questions about dealing with drop down lists - data validation

    Q1: Yes...you could use code like this to select the first item in the DV list:
    Please Login or Register  to view this content.
    Q2: There is no autocomplete in DV cells

    Q3: The below function returns the position of the DV selection in the DV list
    • ALT+F11...to open the VBA Editor
    • Select your workbook from the project list
    • Insert.Module
    • Copy the below code and paste it into that module
    Please Login or Register  to view this content.
    Note: Replace "MyDVList" with whatever name you used for your validation list

    If your DV cell is A2
    use that function this way:
    Please Login or Register  to view this content.
    Q4: Yeah...you didn't ask about it, but...
    If you put your DV List in a Table and assign a range name to the list items,
    that range name will automatically expand and contract to accommodate the number of values in the Table.
    Example:
    In cells C2:C11
    Please Login or Register  to view this content.
    • Select C2:C11
    • Home.Format_as_Table...select a format...Click: OK
    • Select C3:C11
    • Type a range name in the Name Box (to the left of the formula bar)
    ...eg MyDVList
    • In your cell's DV settings
    ...Allow: List
    ...Source: MyDVList

    Is that something you can work with?
    Last edited by Ron Coderre; 02-08-2014 at 11:52 AM.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,626

    Re: Questions about dealing with drop down lists - data validation

    To build on Ron's point number 4 which you didn't ask ...

    If you make your list and convert it to a Table, it will be named something like Table1 (for the first Table created) and, in Ron's example, it will have a column header MyList.

    You don't need to create a Named Range to refer to the Table as it already has a name generated by excel.

    So, you can use:

    Data Validation
    A1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Item Number
    B1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    And you don't need any VBA ... though that's a nice little function.

    See the example attached.

    Regards, TMS
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Questions about dealing with drop down lists - data validation

    Hi Ron & Trevor.

    Thanks guys for your responses, I think I can make some progress from here although the whole "Tables" thing is not something I ever needed to get involved with before so some research is required to fully understand your suggestions.

    Ron, appreciate that it could be as simple as a cell formula, didn't think of that as I am deep into a macro driven solution and immediately thought of vba.

    Thanks again guys, appreciate it when a couple of really experienced contributors take the time to assist

    John (aka jmac1947)

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,626

    Re: Questions about dealing with drop down lists - data validation

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Data Validation, drag and drop, auto population questions
    By Phouthavongc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2013, 10:08 AM
  2. [SOLVED] drop down lists / data validation
    By CashmereCat in forum Excel General
    Replies: 3
    Last Post: 10-11-2012, 12:35 AM
  3. [SOLVED] drop-down list data validation questions
    By Compusafe in forum Excel General
    Replies: 2
    Last Post: 07-30-2012, 10:53 PM
  4. Excel 2008 : Data Validation Drop Down Lists
    By irisorio in forum Excel General
    Replies: 2
    Last Post: 03-02-2011, 09:46 PM
  5. Data Validation - Drop down lists - if then?
    By Steve R in forum Excel General
    Replies: 2
    Last Post: 04-08-2005, 02: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