|
本帖最后由 李贵濮 于 2025-1-19 15:05 编辑
Sub li()
c = Cells(Rows.Count, 1).End(xlUp).Row
c1 = VBA.fix(c * 0.15) + 1
c2 = VBA.fix(c * 0.45) + 1
c3 = VBA.fix(c * 0.8) + 1
For y = 4 To 22 Step 2
Sheet1.UsedRange.Sort Cells(1, y), xlDescending
For x = 2 To c
If x <= 31 Then
Cells(x, y + 1) = "A+"
ElseIf x > 31 And x <= c1 And Cells(x, y) = Cells(31, y) Then
Cells(x, y + 1) = "A+"
ElseIf x > 31 And x <= c1 And Cells(x, y) <> Cells(31, y) Then
Cells(x, y + 1) = "A"
ElseIf x > c1 And x <= c2 And Cells(x, y) = Cells(c1, y) Then
Cells(x, y + 1) = "A"
ElseIf x > c1 And x <= c2 And Cells(x, y) <> Cells(c1, y) Then
Cells(x, y + 1) = "B"
ElseIf x > c2 And x <= c3 And Cells(x, y) = Cells(c2, y) Then
Cells(x, y + 1) = "B"
ElseIf x > c2 And x <= c3 And Cells(x, y) <> Cells(c2, y) Then
Cells(x, y + 1) = "C"
ElseIf x > c3 And Cells(x, y) = Cells(c3, y) Then
Cells(x, y + 1) = "C"
ElseIf x > c3 And Cells(x, y) <> Cells(c3, y) Then
Cells(x, y + 1) = "D"
End If
Next
Next
End Sub |
|