发布网友 发布时间:2024-10-08 09:36
共2个回答
热心网友 时间:2024-12-02 14:06
编制代码如下:
Sub 排名()
Const mymax = 28
Dim i, j As Integer
Dim myname As String
For i = 2 To mymax + 1
myname = Cells(i, 1)
If Cells(i, 3) <= 3 Then
myname = myname & "☆"
Else
If Cells(i, 3) >= mymax - 3 Then
myname = myname & "●"
Else
myname = myname & " "
End If
End If
If Cells(i, 5) <= 3 Then
myname = myname & "☆"
Else
If Cells(i, 5) >= mymax - 3 Then
myname = myname & "●"
Else
myname = myname & " "
End If
End If
If Cells(i, 7) <= 3 Then
myname = myname & "☆"
Else
If Cells(i, 7) >= mymax - 3 Then
myname = myname & "●"
Else
myname = myname & " "
End If
End If
Cells(i, 1) = myname
j = Len(myname)
For k = 1 To j
If Mid(myname, k, 1) = "☆" Then
Cells(i, 1).Characters(k, 1).Font.ColorIndex = 6 '*
End If
If Mid(myname, k, 1) = "●" Then
Cells(i, 1).Characters(k, 1).Font.ColorIndex = 3 '红色
End If
Next k
Next i
End Sub
运行前,如图:
运行后,如图:
热心网友 时间:2024-12-02 14:06
相当于要重赋值