Vlookup in a userform

Jim Stewart

New Member
Joined
Oct 18, 2006
Messages
14
You people are the greatest, a bigggggg help. Maybe you can help with this.
Is there any way to create a userform that a user can enter 2 or 3 variables and cause a search of all the sheets in a workbook to find a record?
Thanks in advance!!!!!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Erdinç E. Karaçam

Board Regular
Joined
Sep 23, 2006
Messages
202
Hi,

Just an example;

UserForm1
TextBox1 ; value: Jim
TextBox2 ; value: Erdinç
TextBox3 ; value: Excel

The codes of CommandButton1 ;

Code:
Private Sub CommandButton1_Click()
    Dim Sh As Worksheet
    On Error Resume Next
    For Each Sh In Worksheets
        [B1] = Sh.Name & "!" & Sh.Cells.Find(TextBox1).Address
        [B2] = Sh.Name & "!" & Sh.Cells.Find(TextBox2).Address
        [B3] = Sh.Name & "!" & Sh.Cells.Find(TextBox3).Address
    Next Sh
End Sub


Sheet1 B10 cell value = Jim
Sheet2 D2 cell value = Erdinç
Sheet3 E7 cell value = Excel

Result of codes on Activesheet (B1-B2-B3):

Sheet1!$B$10
Sheet2!$D$2
Sheet3!$E$7
 

Forum statistics

Threads
1,136,425
Messages
5,675,770
Members
419,585
Latest member
popsin

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