Solved

Lookup a value with Excel VBA

Posted on 2015-01-05
3
105 Views
Last Modified: 2015-01-11
I have a Worksheet containing the format similar to the following ,

Worksheet : "Master"
Product       Description
0001             Item A
0002             Item B

Is there any example to show that when a user input a product code, it will return a description of the product ? I need a VBA code solution, not a lookup function on Excel.

Great Tks
0
Comment
Question by:AXISHK
3 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 250 total points
ID: 40531437
Why not using the VLookup function in VBA?

e.g. Application.Worksheetfunction.VLookup("0001",range("A:B"),2,false)

Open in new window

It builds on what you already know in Excel.
0
 
LVL 29

Assisted Solution

by:gowflow
gowflow earned 250 total points
ID: 40532706
Several ways to do that.

I created a workbook that contains 2 sheet.
Master has in A product codes and in B their respective descriptions

Sheet2 has a combobox that is populated via it's fill list property with the named range that I created for all the product codes I called that name range Product. Simply go to sheet Master and on the left of the address bar you have a box click on the arrow and you will see Product select it and it will highlight the extend of that range.

Now back to sheet2 you can select an item from the dropdown and you will have the description in B2 or type in something in the combobox and see what it gives you. put something that is not a code like Joe or anything and you will also get a result.

Is that what you want ?
gowflow
ProdDescription.xlsm
0
 

Author Closing Comment

by:AXISHK
ID: 40543643
Tks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now