发布网友 发布时间:2022-07-08 13:53
共1个回答
热心网友 时间:2023-10-10 12:17
Private Sub CommandButton1_Click()
Dim I As Integer
Dim L As Integer
Dim A As String
Dim T As Integer
I = 2
While Cells(I, 1) <> ""
I = I + 1
Wend
For L = 2 To I - 1
Cells(L, 51) = ""
Next
For L = 2 To I - 1
A = Cells(L, 1)
For T = L + 1 To I
If Cells(T, 1) = A Then
If Cells(L, 3) > Cells(T, 3) Then
Cells(L, 51) = 1
Else
Cells(T, 51) = 1
End If
End If
Next
Next
For L = 2 To I - 1
If Cells(L, 5) = 1 Then
Rows(L).Delete Shift:=xlUp
End If
Next
我是添加一个按钮触发的,你可以自己灵活调整 ,已经调试过了