+ Reply to Thread
Results 1 to 2 of 2

Dropdown List and List Index

  1. #1
    Registered User
    Join Date
    02-20-2012
    Location
    Austin
    MS-Off Ver
    Excel 2010
    Posts
    28

    Dropdown List and List Index

    I am trying to figure out how to do this using VBA.

    1) I have defined an array (10) called "Names"

    2) In Cell B1 I a dropdown list from the "Names" array. (=Names)

    3) In cell A1 the user can enter a number between 1 and 30.

    4) If the user enters lets say the value 3. I am wanting cell B1 to change to the 3rd value in the "Names" array. I know you can use the INDEX(Names,3) or INDEX(Names,A1) but I do not want the formula to change in the dropdown list because if the user enters a number greater than 10, then they can manually select from the dropdown list. I have seen some post about List Index but do not quite understand it or even if it is valid here.

    5) There might be a way to set the index under .Validation of a cell but I am not sure.

    Any thoughts or if you need clarification let me know. I am new to VBA and trying to learn. Thanks for any feedback.

  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: Dropdown List and List Index

    1) The data validation LIST source in B1 should be:
    =IF(A1>10, Names)

    2) Right-click the sheet tab and select VIEW CODE to add this macro into the sheet module:

    Please Login or Register  to view this content.
    _________________
    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!)

+ 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