Sub Step4()
'sub looks compares destination to customer ID, TRUE if match, false if no match
Dim myLastRow As Long
Dim myWorksheet As Worksheet
Dim myWorksheet2 As Worksheet
Dim myLastRow2 As Long
Set myWorksheet = Worksheets("HazShipper")
myLastRow = myWorksheet.Cells(myWorksheet.Rows.Count, "A").End(xlUp).row
Set myWorksheet2 = Worksheets("DGbyFLT")
myLastRow2 = myWorksheet2.Cells(myWorksheet2.Rows.Count, "A").End(xlUp).row
ActiveWorkbook.Sheets("HazShipper").Select
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Range("Z2").Formula = "=LEFT(TRIM(CLEAN(Q2)),3)"
Range("AA2").Formula = "=TRIM(CLEAN(K2))"
Range("AB2").Formula = "=IF(ISNA(VLOOKUP(TRIM(U2),DGbyFLT!$A$2:$Z$" & myLastRow2 & ",26,0)),""No ID"",VLOOKUP(TRIM(U2),DGbyFLT!$A$2:$Z$" & myLastRow2 & ",26,0))"
[COLOR=#008000] 'Range("AB2").Formula = "=IF(ISNA(VLOOKUP(TRIM(U2),DGbyFLT!$A$2:$Z$" & myLastRow2 & ",26,0)," & Chr(34) & "No ID" & Chr(34) & ",VLOOKUP(TRIM(U2),DGbyFLT!$A$2:$Z$" & myLastRow2 & ",26,0)))"[/COLOR]
[COLOR=#008000] 'Range("AB2").Formula = "=IF(ISNA(VLOOKUP(Z2,AirportCodes!$A$2:$B$2000,2,0)),""No Departure"",VLOOKUP(Z2,AirportCodes!$A$2:$B$2000,2,0))"[/COLOR]
[COLOR=#008000] 'Range("AB2").Value = "=IFERROR(VLOOKUP(Z2,AirportCodes!$A$2:$C$2000,2,0),""No Departure"")"[/COLOR]
[COLOR=#008000] Range("AC2").Formula = "=IF(LEFT(K2,4)=LEFT(AB2,4),True,False)"[/COLOR]
Range("Z2:AC2").Select
Selection.AutoFill Destination:=Range("Z2:AC" & myLastRow)
Range("Z1").Select
ActiveCell.FormulaR1C1 = "Customer ID"
Range("AA1").Select
ActiveCell.FormulaR1C1 = "HazShipper Destination"
Range("AB1").Select
ActiveCell.FormulaR1C1 = "Airport Code Destination"
Range("AC1").Select
ActiveCell.FormulaR1C1 = "Dest. Match?"
Range("Z1:AC1").Select
Selection.Font.Bold = True
Range("Z1,AA1").Select
With Selection.Interior
.Color = 65535
End With
Columns("Z:Z").ColumnWidth = 8.86
Columns("AA:AC").EntireColumn.AutoFit
Columns("Z:AC").Select
With Selection
.HorizontalAlignment = xlCenter
End With
Columns("AC:AC").ColumnWidth = 6.86
Columns("Z:AC").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("AD2").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub