Option Explicit
Sub FindHighestScoreAndCreateCollection()
Dim scores(1 To 10) As Integer
Dim i As Integer
Dim highestScore As Integer
Dim highestScoreIndex As Integer
Dim myCollection As New Collection
'假设给数组赋值,这里只是示例
scores(1) = 75
scores(2) = 85
scores(3) = 90
scores(4) = 78
scores(5) = 88
scores(6) = 95
scores(7) = 82
scores(8) = 70
scores(9) = 80
scores(10) = 92
highestScore = scores(1)
highestScoreIndex = 1
For i = 2 To 10
If scores(i) > highestScore Then
highestScore = scores(i)
highestScoreIndex = i
End If
If scores(i) > 80 Then
myCollection.Add scores(i)
End If
Next i
MsgBox "成绩最高的学生序号为:" & highestScoreIndex & ",对应的成绩为:" & highestScore
Dim item As Variant
For Each item In myCollection
Debug.Print item
Next item
End Sub