Sub 完全数判定()
Dim a As Long
Dim b As String
Dim c As String
Dim i As Long
Dim s As Long
a = InputBox("a = ")
b = "完全数"
c = "完全数ではない"
For i = 1 To a - 1
If a Mod i = 0 Then
s = s + i
End If
Next i
If s = a Then
Call MsgBox(b)
Else
Call MsgBox(c)
End If
End Sub