Back to original file
Dim sh as Worksheet
set sh = ActiveSheet
fName = Application.GetOpenFilename
Workbooks.Open fName
sh.parent.Activate
sh.Activate
sh.Range("N2") _
.FormulaR1C1 = _
"=VLOOKUP(RC[-13],'[fName]Qty-Value'!$A:$C,2,FALSE)"
--
Regards,
Tom Ogilvy
"brook6" wrote in message
...
I have a macro that opens a file to use for VLOOKUP function. I start in
original file, ask user for file to use and I want to execute the function
in my original file, not the file I opened.
fName = Application.GetOpenFilename
Workbooks.Open fName
Range("N2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-13],'[fName]Qty-Value'!$A:$C,2,FALSE)"
I think I need something before this to capture the name of the original
file/worksheet, so I can get back to it before I execute the formula.
|