Solved

Lookup a value with Excel VBA

Posted on 2015-01-05
3
112 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 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 30

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

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

705 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