Sub mymacro()
Dim i As Integer
Dim scoreA As Integer
Dim total As Integer
Dim count As Integer
total = 0
count = 0
For i = 1 To 20
scoreA = Range(“A” & i).Value
If scoreA >= 80 Then
total = total + scoreA
count = count + 1
End If
Next i
If count > 0 Then
Cells(22, 2).Value = total / count
Else
Cells(22, 2).Value = “該当なし”
End If
End Sub
Excel VBA 問題解答2026/7/12
Ecel VBA学習記録

コメント