我正在尝试对大约10万行的SAP拉取进行排序。该排序需要30分钟才能运行。你能看看这个吗,看看是否有我可以简化我的排序的方法?
谢谢!
'''
Sub Sort_CFG_InvOnHand_Tab()
Dim wb As Workbook
Dim Ws2 As Worksheet
Set wb = Workbooks("TTB - Inv on hand - CFG_CL")
Set Ws2 = wb.Worksheets("InvOnHand")
Ws2.Activate
Dim N As Long, i As Long
N = Cells(Rows.Count, "H").End(xlUp).Row
For i = N To 2 Step -1
If Cells(i, "V") = "0" And Cells(i, "X") = "0" Then
Cells(i, "V").EntireRow.Delete
End If
If Left(Cells(i, "H"), 2) = "AA" Or Left(Cells(i, "H"), 2) = "DM" Or Left(Cells(i, "H"), 2) = "MX" Or Left(Cells(i, "I"), 3) = "EFN" Then
Cells(i, "H").EntireRow.Delete
End If
Next i
N = Cells(Rows.Count, "U").End(xlUp).Row
Cells(N + 2, "U") = "Total"
Cells(N + 3, "U") = "Negative Inventory"
Cells(N + 4, "U") = "Updated Total"
Cells(N + 6, "U") = "Prior Month Ending"
Cells(N + 8, "U") = "Difference"
Cells(N + 2, "V").Formula = "=SUM(V2:V" & N & ")"
Cells(N + 3, "V").Formula = "=SUMIF(V2:V" & N & ",""<0"")"
Cells(N + 4, "V") = Cells(N + 1, "V") - Cells(N + 2, "V")
Cells(N + 2, "X").Formula = "=SUM(X2:X" & N & ")"
Cells(N + 3, "X").Formula = "=SUMIF(X2:X" & N & ",""<0"")"
Cells(N + 4, "V") = Cells(N + 1, "V") - Cells(N + 2, "V")
MsgBox ("Sort Complete")
End Sub
'''