Hello Everyone,
Can somebody help me with this? Functionally speaking, I think it works but I believe there is a syntax problem.
Code
Dim MyName As String
MyName = ThisWorkbook.Name
ActiveWorkbook.Names.Add Name:="MainRange", RefersToR1C1:=MainRange
MainWorkBook.Activate
Sheets("Main Worksheet").Select
Range("A1").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-8],MyName!MainRange,2,FALSE)"
The error is around the MyName!rRange part. I am unsure of why this is not working, as MyName is the opened file name and MainRange is a defined range in MyName. Please advise. Thanks.