So, for my work we are constantly cross referencing Part #'s. I am looking to create a VBA that will VLOOKUP column 13, 14, 23, 24 From sheet 2 and copy and paste values to sheet 1 R-U. I tried recording the macros on my first sheet and it worked fine, but when I try it on a different workbook it doesn't seem to work. Below is what I have. Sub Vlookupandreplacetemplate() ' ' Vlookupandreplacetemplate Macro '
'
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-16],Sheet2!C[-17]:C[64],13,0)"
Selection.AutoFill Destination:=Range("R2:R401")
Range("R2:R401").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-16],Sheet2!C[-17]:C[64],13,0)"
Range("S2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-17],Sheet2!C[-18]:C[63],14,0)"
Range("S2").Select
Selection.AutoFill Destination:=Range("S2:S401")
Range("S2:S401").Select
Range("T2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-18],Sheet2!C[-19]:C[62],23,0)"
Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T401")
Range("T2:T401").Select
Range("U2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-19],Sheet2!C[-20]:C[61],24,0)"
Range("U3").Select
ActiveCell.FormulaR1C1 = ""
Range("U2").Select
Selection.AutoFill Destination:=Range("U2:U401")
Range("U2:U401").Select
Columns("R:U").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Replace What:="#N/A", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub