我有一个包含3列的数据,并且有重复项。我想为A列中的每个重复项从C列中选择最大值。是否有更快的方法?
Sub HighestValues()
'This Sub is to pick the highest value if there are duplicates
Dim LastRow As Long
LastRow = Worksheets("Product Qty").Cells(Rows.Count, "A").End(xlUp).Row
Dim i As Long
Application.ScreenUpdating = False
For i = LastRow To 2 Step -1
If Cells(i, "A").value = Cells(i - 1, "A").value Then
If Cells(i - 1, "C").value > Cells(i, "C").value Then
Rows(i).delete
Else
Rows(i - 1).delete
End If
End If
Next i
Application.ScreenUpdating = True
End Sub