dean_wat
09-28-2007, 08:38 AM
I am trying to write code that uses a select case that ask whether or not to add, subtract, multiply or divide the two numbers. Here is what I already have, can anyone please help me.:banghead:
Option Compare Database
Option Explicit
Sub Numbers()
Dim intNum1 As Integer
Dim intNum2 As Integer
Dim intAnswer As Double
Dim Math As Integer
intNum1 = InputBox("Enter the first number: ")
intNum2 = InputBox("Enter the second number: ")
Select Case Math
Case 1
intAnswer = intNum1 + intNum2
Case 2
intAnswer = intNum1 - intNum2
Case 3
intAnswer = intNum1 / intNum2
Case 4
intAnswer = intNum1 * intNum2
End Select
MsgBox "The answer of the numbers entered is" & intAnswer
End Sub
EDIT: Added Code tags Tommy
Option Compare Database
Option Explicit
Sub Numbers()
Dim intNum1 As Integer
Dim intNum2 As Integer
Dim intAnswer As Double
Dim Math As Integer
intNum1 = InputBox("Enter the first number: ")
intNum2 = InputBox("Enter the second number: ")
Select Case Math
Case 1
intAnswer = intNum1 + intNum2
Case 2
intAnswer = intNum1 - intNum2
Case 3
intAnswer = intNum1 / intNum2
Case 4
intAnswer = intNum1 * intNum2
End Select
MsgBox "The answer of the numbers entered is" & intAnswer
End Sub
EDIT: Added Code tags Tommy