?
Solved

Lookup a value with Excel VBA

Posted on 2015-01-05
3
Medium Priority
?
114 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
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.

752 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