Combo boxes

mags74

New Member
Joined
Jul 19, 2007
Messages
7
How do you add a vlookup or index match through visual basic based on what is chosen from the combo box? I am sure this has already been asked and answered, but my search button is not working correctly. Sorry.

Also, I would like to do the vlookup or index match from a separate page that the results would go.

I have an "input" page with the combo box (A1) and the cell (B2) for the data for the vlookup is on a "data" page in the workbook.

Thank you all for your help in advance.

:eek:
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
Hi
from your message, it is not clear what you are looking up from where
Assuming you are looking for combo box choice in col a of data sheet and corresponding value in col b
Paste the following codes in the macro window ( Alt f8)

Code:
cells(1,2) = application.worksheetfunction.vlookup(cells(1,1), worksheets("data").range("A2:B100"),2,false)
msgbox " Value corresponding to " & cells(1,1) & "  is  " & cells(1,2)
run the macro
Ravi
 
Upvote 0

mags74

New Member
Joined
Jul 19, 2007
Messages
7
is there a way to do this without having to run a macro and it just automatically updating the cell once a certain item is chosen from the combo box?

in the cell next to the combo box - would be where the vlookup results would be - but i would like to do the vlookup through visual basic so there are no formulas on the spreadsheet. the list for the vlookup are on a separate tab.
 
Upvote 0

Forum statistics

Threads
1,186,908
Messages
5,960,517
Members
438,481
Latest member
KBChristensen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top