I have the following code which does insert formulas in the right location yet when inserting it changes the formula syntax. The actual error is #NAME? ,The code is as follows:
Sub InsertFormulas()
'Transition Data Corretion
Dim lLR As Long
lLR = Range("A2").End(xlDown).Row 'Starts at A2 "Reference Column" and goes to Empty Cell-1
'Enter Formulas into CarAllow Sheet
Range("B2:B" & lLR).FormulaR1C1 = "=IF(ISNA(VLOOKUP(A2,Sheet1!A:E,2,FALSE))=TRUE,A2,VLOOKUP(A2,Sheet1!A:E,2,FALSE))"
Range("D2:D" & lLR).FormulaR1C1 = "=IF(ISNA(VLOOKUP(A2,Sheet1!A:E,5,FALSE))=TRUE,C2,VLOOKUP(A2,Sheet1!A:E,5,FALSE))"
''''
End Sub
When in the spreadsheet, the syntax is changed to:
=IF(ISNA(VLOOKUP('A2',Sheet1!A
E),5,FALSE))=TRUE,$B:$B,VLOOKUP('A2',Sheet1!A
E),5,FALSE))
Notice the quote/Tick marks around the A2 and Parenthesis around E. I tried Modifying the code but my changes wouldn't work. I feel like this is something simple im overlooking.
Any help is appreciated.
Bookmarks