+ Reply to Thread
Results 1 to 11 of 11

VBA vlookup drop down list

  1. #1
    Forum Contributor
    Join Date
    07-18-2014
    Location
    Missouri, USA
    MS-Off Ver
    2010
    Posts
    175

    VBA vlookup drop down list

    I have 2007. I have a master spreadsheet with all the companies part number in the first column, then description, weight, height, depth, master pack, inner pack, UPC, cost.....one and one. I then have multiple customers that ask us to submit our items to them, and each spreadsheet from the customer is a little different. One wants the weight in column D while another wants the weight in column W. I want to open the customers spreadsheet, manually enter my part number's in column A, click on B2 and run a macro that ask's me what information I want to have entered in column B, like "Description". The marco would then run a vlookup of the parts I entered in column A and pull the "Description" from my master spreadsheet. Then click on C2, run the same marco, pick "Weight" to fill in that column and continue until I have everything I need pulled from the master.
    Can VBA do that? I can't figure out entering a drop down list for the "Col_index_num" variable. Thanks for your help.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA vlookup drop down list

    Hi, rs1aj,

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Maybe the macro can be based on the headers of the worksheets but I would need to see some information.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    07-18-2014
    Location
    Missouri, USA
    MS-Off Ver
    2010
    Posts
    175

    Re: VBA vlookup drop down list

    I need to fill out all of Vendor 1 and Vendor 2's missing information. Right now I am clicking in B2 of Vendor 1 Sheet, doing a vlookup pulling in 2(col_index_num) and copying down, copying the formula to C2, changing the "col_index_num" to 16 and copying down....so on until I have the sheet filled out, then repeating process for Vendor 2 Sheet. But as you can see, Vendor 2 Sheet does not match the same order or same information as Vendor 1 Sheet so I can't copy and paste formula's over to the second sheet.
    I'm thinking it would be easier to write a VBA program that already uses $A2 as the "lookup_value", has the "table array" set, and "False" set as the "Range_lookup" and when I click in B2 of Vendor 1 Sheet, I can run the VBA macro and it pop's up a drop down list in a message box with each title that is on my Master Spreadsheet(Description, Cat pg, Category, Pack Qty, UPC.....) so all I have to do is pick "Description" and by picking that, the macro picks 2 as the "col_index_num" and fills out the right information. I move over to C2, run the VBA macro again, pick "Cost 3" from the drop down list and continue until the form is complete.
    1. Is there an easier way?
    2. How do I write the VBA program to use "col_index_num" as a variable in the vlookup and have all of my column headers from my Master Spreadsheet on the drop down list?

    Thanks for your help on this.
    Attached Files Attached Files

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA vlookup drop down list

    Hi, rs1aj,

    thanks for the sample. Could you please indicate for how many different sheets this should be applied (this may determine if I will try using a lookup matrix or try to code in a macro)?

    Will the description of the headings maybe differ on different items as UPC and Universal Product Code as it is right now? Where would I find Length/Width, Lbs, Pack Units for Vendor 1 or Our Cost, Pkg Height, and Case Qty for Vendor 2 in Master? What about the different costs, which column to take for which (maybe depending on quantity/forwarder/Express delivery)?

    Sorry but these questions came up when I looked at the workbook supplied. I would be glad if you could try and point me into the direction.

    Ciao,
    Holger

  5. #5
    Forum Contributor
    Join Date
    07-18-2014
    Location
    Missouri, USA
    MS-Off Ver
    2010
    Posts
    175

    Re: VBA vlookup drop down list

    Thank you for your help on this.

    I will have up to 20 different Vendors submitting sheets similar to this. All of them basically want the same information...example...most all of them want the products height which is on my "Master Spreadsheet" in column G labeled "Pkg Height". One vendor will submit a sheet like "Vendor 1 Sheet", which is asking for that information in column F labeled "Hgt", the next vendor will submit a form like Vendor 2 Sheet wanting that same information but have it in column I and have it labeled "pkg height", which just so happens to match my label title from my "Master Spreadsheet". Some match my headers, most don't, and all of them are in different columns on their sheets.
    All vendors need the cost, 5 of them will get "Cost 1" from my sheet, 7 will get "Cost 2", 4 will get "Cost 3" and so on based on who they are so I have to assign the correct cost column to them manually.
    All vendors are asking for different products...example...Vendor 5 wants ten of my items and Vendor 12 wants 25 totally different items of mine, all are in different orders down column A on their sheets and sometimes a vendor has my part numbers listed down column F on their sheet. Of course, my "Master Spreadsheet" never changes and always has my part numbers in order down column A, which works well for vlookup purposes.
    Last edited by rs1aj; 07-20-2014 at 09:52 AM.

  6. #6
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Thumbs up Re: VBA vlookup drop down list

    I have solved your problem.. ( I think so...)
    with no array..

    but you have to keep the same column headers as in the master sheet... to get the desired result...(hopefully you can do it..)

    I hope it will be purposeful..

    check the attachment..


    Don't forget to click *, if it helps you someway...
    Attached Files Attached Files

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA vlookup drop down list

    Hi, Vikas_Gautam,

    Quote Originally Posted by OP
    and each spreadsheet from the customer is a little different.
    Quote Originally Posted by Vikas_Gautam
    but you have to keep the same column headers as in the master sheet... to get the desired result...(hopefully you can do it..)
    I´m glad you "solved" this problem although OP has mentioned different headings in each Vendor sheet.

    Ciao,
    Holger

  8. #8
    Forum Contributor
    Join Date
    07-18-2014
    Location
    Missouri, USA
    MS-Off Ver
    2010
    Posts
    175

    Re: VBA vlookup drop down list

    You are correct HaHoBe, the Vendors titles are going to be a little different than mine so while this would work for some columns, it will not work for most.

    I am using "Name Manager" to name each column on my master spreadsheet like this: =OFFSET('Master Spreadsheet'!$E$1,1,0,COUNTA('Master Spreadsheet'!$A:$A)-1,1). Could a VBA program be written that uses vlookup but allows me to enter the "col_index_num" by selecting from a list of my "Name Manager" names from a message box?

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA vlookup drop down list

    Hi, rs1aj,

    I´ve added a new sheet to the workbook called Tables. Please have a look at it as it holds the correlation between the information from your Master Spreadsheet and the individual Vendor Sheets which should be completed for the other sheets you have on hand. I marked two cells with yellow and question marks as I wasn´t able to guess at what values would be needed to be copied over there. For text for these cells would be "Please check!!!" unless you fill the cells with the proper columns.

    The code I used is placed in ThisWorkbook:
    Please Login or Register  to view this content.
    Please take your time going through the code and to check if the result is near to what you want (and if you can add the information into Tables by yourself as needed).

    Workbook attached.

    Ciao,
    Holger
    Attached Files Attached Files

  10. #10
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Thumbs up Re: VBA vlookup drop down list

    Got the new solution buddy..
    check the attached file...

    I have used array formula..
    So use ctrl + shift + enter to enter the formula..
    Don't use only enter..


    Don't forget to click *
    Attached Files Attached Files

  11. #11
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA vlookup drop down list

    Hi, Vikas_Gautam,

    Got the new solution buddy..
    Well, on Vendor 2 Sheet the Universal Product Code, Our Cost and Case Qty should be different from Part, same goes for Vendor 1 Sheet with Hgt, Length/Width, Lbs, and Pack Units. You should check before posting a workbook, not us!

    Ciao,
    Holger

+ 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. Two drop down list and VLOOKUP
    By Devi Suryani in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-18-2013, 02:46 AM
  2. Using VLOOKUP in drop-down list
    By concretetsunami in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 08-13-2013, 01:35 PM
  3. Replies: 1
    Last Post: 09-05-2012, 11:39 AM
  4. Can I add a drop-down list to a Vlookup?
    By dsharb52 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-11-2006, 06:35 PM
  5. [SOLVED] Drop Down List + VLOOKUP
    By Bonbon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-12-2006, 12:45 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