Solved

Lookup a value with Excel VBA

Posted on 2015-01-05
3
104 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
Comment Utility
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
Comment Utility
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
Comment Utility
Tks
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

763 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

7 Experts available now in Live!

Get 1:1 Help Now