Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Lookup a value with Excel VBA

Posted on 2015-01-05
3
Medium Priority
?
115 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 1000 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 31

Assisted Solution

by:gowflow
gowflow earned 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

610 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