I have troubles in running the following codes. Basically the idea is to sort the list and copy the unique records to another sheet. But due to the large number of records (160000 rows). My code always hanged and could not stop calculation.
Columns("A:A").Insert Shift:=xlToRight
Range("A1").Value = "Reference2"
Range("A2").Formula = "=B2&F2&N2"
Range("A2").AutoFill Destination:=Range("A2:A160000")
Range("N1").Value = "Day"
Range("N2").Formula = "=DAY(G2)"
Range("N2").AutoFill Destination:=Range("N2:N160000")
Columns("A:N").Select
Selection.Sort Key1:=Range("N2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Columns("A:N").Select
Selection.Sort Key1:=Range("F2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Columns("A:N").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sheets("Fairbanks Data").Range("A1:N" & Range("B1").End(xlDown).Row).Select
Selection.Copy
Sheets("Fairbanks Data(Edited)").Cells(Rows.Count, "A").End(xlUp).PasteSpecial xlPasteValues
'my code always stopped at here and did the calculation
Sheets("Fairbanks Data").Delete
Sheets("Fairbanks Data(Edited)").Range("A1:A160000").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheets("Step1Raw").Range("A2"), Unique:=True
Is that any way I can improve the speed? Thank you for your time!