Create UserForm with Vlookup

shre0047

Board Regular
Joined
Feb 3, 2017
Messages
53
Office Version
  1. 365
Platform
  1. Windows
I want to create a user-form with a combo box (CB1) and 2 text boxes (TB1 & TB2). Based on the input for CB1 and TB1, the output will show in TB2.

For CB1, there would be 4 different values:
Code:
Private Sub UserForm_Initialize()    
    CB1.AddItem "Search DB1"
    CB1.AddItem "Search DB2"
    CB1.AddItem "Search DB3"
    CB1.AddItem "Search DB4"
End Sub

And depending on which value is selected in CB1, it would trigger a vLookup value of TB1 into a different sheet, and input a value into TB2.

I'm fairly green in the user-form feature so looking for guidance. Thanks for any help.

Pseudocode:
If 'Search DB1' selected, find TB1 value in sheet1, column B, and return value into TB2
If 'Search DB2' selected, find TB1 value in sheet2, column Q, and return value into TB2
If 'Search DB3' selected, find TB1 value in sheet3, column T, and return value into TB2
If 'Search DB4' selected, find TB1 value in sheet4, column A, and return value into TB2
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,215,025
Messages
6,122,734
Members
449,094
Latest member
dsharae57

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
Back
Top