Do While .Cells(i, "E") <> ""
If (.Cells(i, "b") & .Cells(i, "E") = .Cells(i + 1, "b") & .Cells(i + 1, "E")) Then
If Rng Is Nothing Then
Set Rng = .Cells(i, "E").Offset(1)
Else
Set Rng = Union(Rng, .Cells(i, "E").Offset(1))
End If
End If
i = i + 1
Loop
If Not Rng Is Nothing Then
Rng.EntireRow.Delete
' 我自己寫的 主要是處理考慮點2
i = 2
Do While .Cells(i, "E") <> ""
If .Cells(i, "b") = .Cells(i + 1, "b") Then
If .Cells(i, "E") > .Cells(i + 1, "C") Then
.Rows(i + 1).Delete Shift:=xlUp
i = i - 1
End If
End If
i = i + 1
Loop
.UsedRange.Sort Key1:=.Range("C2"), Order1:=xlAscending, Key2:=.Range( _
"A2"), Order2:=xlAscending, Header:=xlYes
End If