プロフィール
@sukekiyo
@sukekiyo
@sukekiyoをフォローする

今日のVBA(復習)2026/7/22正解

Ecel VBA学習記録
Sub mymacro()

Dim i As Integer
Dim total As Long
Dim average As Double
Dim over80 As Integer
Dim maxpoint As Integer
Dim excellent As Integer
Dim score As Integer

total = 0
over80 = 0
maxpoint = Range("A1").Value
excellent = 1

For i = 1 To 20

score = Range("A" & i).Value

total = total + score

If score >= 80 Then
over80 = over80 + 1
End If

If score > maxpoint Then
maxpoint = score
excellent = i
End If

Next i

average = total / 20

Range("B22").Value = total
Range("B23").Value = average
Range("B24").Value = over80
Range("B25").Value = maxpoint
Range("B26").Value = excellent

End Sub

コメント

タイトルとURLをコピーしました