Get to use closed workbook dat in vba lookup

TurboDieselOne

Board Regular
Joined
Oct 29, 2008
Messages
52
Hi I have the following code

Code:
 Private Sub Userform_Activate() [code]
[code]On Error Resume Next [code]
[code]TextBox1.Value = ActiveCell [code]
[code]Search = Application.WorksheetFunction.VLookup(Left(RightTextBox1, 21), 6), Range("Notessearch"), 16, False) [code]
[code]TextBox1.Value = ActiveCell & Chr(10) & "----------" & Chr(10) & Search [code]
[code]On Error GoTo 0[code]
End Sub
 
 
how can i change this to open a workbook then lookup in the range "Notesearch" in this workbook apply the data to the :-
 
TextBox1.Value = ActiveCell & Chr(10) & "----------" & Chr(10) & [B]Search[/B]
 
then close the Workbook
 
ActiveCell is on this workbook but the data for [B]Search[/B] is on the closed workbook
 
 
Thanks
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Try this out, behind your form on initialise or activate

Private Sub UserForm_Initialize()
Workbooks.Open "C:\Path to Workbook\name of workbook.xls"
Application.Goto Reference:="NoteSearch"
ActiveCell.Copy
ActiveWorkbook.Close
Me.TextBox1.Paste
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,754
Members
452,940
Latest member
rootytrip

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