VLookup to another workbook from inside of a user form

mjmartin

New Member
Joined
Mar 10, 2017
Messages
7
Good morning - I wonder if someone can help me.

I have a workbook with a user form that looks like this
1633010778407.png

Currently, when the user inputs a "Wind Dollar Serial #", the form will use vlookups to find that serial number, currently found on another tab in the same workbook, and display the "Denomination" and "Department Head"
Similarly, below that, when the user inputs a TM#, the form will do vlookups to find the number, again on a different tab in the same workbook, to grab the TM Name and Department.

The code for these currently look like this:

Private Sub TextBox2_Change()

On Error Resume Next

WindDollarLog.TextBox3.Value = ""
WindDollarLog.TextBox4.Value = ""


WindDollarLog.TextBox3.Value = Application.WorksheetFunction.VLookup(CDbl(WindDollarLog.TextBox2.Value), Sheet3.Range("A:C"), 2, 0)
WindDollarLog.TextBox4.Value = Application.WorksheetFunction.VLookup(CDbl(WindDollarLog.TextBox2.Value), Sheet3.Range("A:C"), 3, 0)



Private Sub TextBox5_Change()

On Error Resume Next

WindDollarLog.TextBox6.Value = ""
WindDollarLog.TextBox7.Value = ""


WindDollarLog.TextBox6.Value = Application.WorksheetFunction.VLookup(CDbl(WindDollarLog.TextBox5.Value), Sheet4.Range("B:E"), 2, 0)
WindDollarLog.TextBox7.Value = Application.WorksheetFunction.VLookup(CDbl(WindDollarLog.TextBox5.Value), Sheet4.Range("B:E"), 4, 0)


Private Sub TextBox8_Change()

On Error Resume Next

WindDollarLog.TextBox9.Value = ""
WindDollarLog.TextBox10.Value = ""


WindDollarLog.TextBox9.Value = Application.WorksheetFunction.VLookup(CDbl(WindDollarLog.TextBox8.Value), Sheet4.Range("B:E"), 2, 0)

WindDollarLog.TextBox10.Value = Application.WorksheetFunction.VLookup(CDbl(WindDollarLog.TextBox8.Value), Sheet4.Range("B:E"), 4, 0)

What I would like to do is to have these sheets continue to do the vlookup, but instead of finding the info in different tabs of this same workbook, I'd like for the lookup to find the information in a completely different workbook on the network.

Is this possible? If so, can someone help me with the changes I'd need to make to the code? I'm a complete novice and was kind of lucky to get the **** form to work in the first place! Haha!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,181,606
Messages
5,930,869
Members
436,764
Latest member
avalladarez

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