+ Reply to Thread
Results 1 to 2 of 2

Macro: From Dropdown text containing value, nest line result another value

  1. #1
    Registered User
    Join Date
    01-26-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    55

    Macro: From Dropdown text containing value, nest line result another value

    Hello,
    I have this example attached.
    In column A1:A7 I have some drop down Data Validation lists and they are all the same.
    I would like to have a macro so that when I enter a choice from the list, the next line will be filled out automatically with a value from the list with another value, always from the same list.
    Ex. If a line has a text containing 500A the very next line will be filled with another value from the list i.e. text containing 600B.
    If a line has a text containing 500B the very next line will be the one with text containing 600D.
    I have only lines 500A and 500B that need this second line value....

    Sorry for my English.....I realize it sounds weird!!!!!

    Thanks
    R
    Attached Files Attached Files

  2. #2
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Macro: From Dropdown text containing value, nest line result another value

    You can use a bit of VBA for this. Go to the VBA IDE (alt-F11) and put this code in the module of the worksheet where you want to auto-populate the cells:

    Please Login or Register  to view this content.
    Then, on another worksheet, build a map like this:

    Text containing 500A Text containing 600B
    Text containing 500B Text containing 600D

    and give it a name of NestMap.

    When you change the target worksheet within the range of A2:A8, it will trigger the code to look for the value in the NamedRange with the map. If a match is found, it will change the row immediately below to the mapped value.

    BTW, I would recommend you use a named range for your data validation map as well, over time it will work better than typing the validation entries directly into your data validation.

+ 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