VBA 整数の約数を出す
Sub 約数すべて()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim i As Integer
a = InputBox("a =")
For i = 1 To a
c = a Mod i
If c = 0 Then
Call MsgBox(i)
End If
Next i
End Sub
Sub 約数すべて()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim i As Integer
a = InputBox("a =")
For i = 1 To a
c = a Mod i
If c = 0 Then
Call MsgBox(i)
End If
Next i
End Sub