Hi Mumps,
I use macro to add fomular into col T,U,V,X,Y,AC and AD, but the data of sheet Fr orders is too much, so that my code didn’t run well. I vlookup data from Data Wb (Outstanding sheet) into FR orders, and compare have any duplicate with sheet Fabship and Trimship. Pls see the attached file. Thanks for your generous help.
Sub formula_FRorders()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim lRow As Long
Set ws = Sheets("FR orders")
With ws
lRow = .Range("A" & .Rows.count).End(xlUp).row
.Range("T2:T" & lRow).Formula = "=LEFT(RC[-18],10)"
'.Range("T2:T" & lRow).Value2 = .Range("T2:T" & lRow).Value2
.Range("U2:U" & lRow).Formula = "=IFERROR(VLOOKUP(RC[-19],[Data.xlsx]Outstanding!C1:C6,3,0),IFERROR(VLOOKUP(LEFT(RC[-19],10),[Data.xlsx]Outstanding!C1:C6,3,0),""-""))"
'.Range("U2:U" & lRow).Value2 = .Range("U2:U" & lRow).Value2
.Range("V2:V" & lRow).Formula = "=IFERROR(VLOOKUP(RC[-20],[Data.xlsx]Outstanding!C1:C6,4,0),IFERROR(VLOOKUP(LEFT(RC[-20],10),[Data.xlsx]Outstanding!C1:C6,4,0),""-""))"
'.Range("V2:V" & lRow).Value2 = .Range("V2:V" & lRow).Value2
.Range("X2:X" & lRow).Formula = "=IFERROR(VLOOKUP(RC[-22],[Data.xlsx]Outstanding!C1:C6,5,0),IFERROR(VLOOKUP(LEFT(RC[-22],10),[Data.xlsx]Outstanding!C1:C6,5,0),""-""))"
'.Range("X2:X" & lRow).Value2 = .Range("X2:X" & lRow).Value2
.Range("Y2:Y" & lRow).Formula = "=IFERROR(VLOOKUP(RC[-23],[Data.xlsx]Outstanding!C1:C6,6,0),IFERROR(VLOOKUP(LEFT(RC[-23],10),[Data.xlsx]Outstanding!C1:C6,6,0),""-""))"
'.Range("Y2:Y" & lRow).Value2 = .Range("Y2:Y" & lRow).Value2
.Range("AC2:AC" & lRow).Formula = "=IF(ISERROR(MATCH(RC[-18],FabShipping!C1,0)),"""",""DUPLICATE"")"
'.Range("AC2:AC" & lRow).Value2 = .Range("AC2:AC" & lRow).Value2
.Range("AD2:AD" & lRow).Formula = "=IF(ISERROR(MATCH(RC[-19],TrimShipping!C1,0)),"""",""DUPLICATE"")"
'.Range("AD2:AD" & lRow).Value2 = .Range("AD2:AD" & lRow).Value2
End With
Application.ScreenUpdating = True
End Sub
Display More