Sub Ans1()
Dim Base As Double
Dim top As Integer
Base = 5
top = 23
For i = 1 To top
Title = "Sum & Product"
prompt = "The Sum of " + CStr(i) + " and " + CStr(Base) + " = " + CStr(i + Base)
prompt = prompt + Chr(10)
prompt = prompt + "The Product of " + CStr(i) + " and " + CStr(Base) + " = " + CStr(i * Base)
MsgBox prompt, vbOKOnly, Title
Next i
End Sub
This will return a dialog like:
Code:
Sub Ans2()
Dim Base As Double
Dim top As Integer
Base = 5
top = 23
Debug.Print "i", "i + " + CStr(Base), "i * " + CStr(Base)
Debug.Print "==========", "==========", "=========="
For i = 1 To top
Debug.Print i, i + Base, i * Base
Next i
End Sub
Sub Ans3()
Dim Base As Double
Dim top As Integer
Base = 5
top = 23
Range("A1") = "i"
Range("B1") = "i + " + CStr(Base)
Range("C1") = "i * " + CStr(Base)
Range("A2") = "'======="
Range("B2") = "'======="
Range("C2") = "'======="
For i = 1 To top
Cells(2 + i, 1) = i
Cells(2 + i, 2) = i + Base
Cells(2 + i, 3) = i * Base
Next i
End Sub