-
Noob needs help with vb code!
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.
[VBA]
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
[/VBA]
EDIT: Added Code tags Tommy
-
dean
Where are you actually setting/getting a value for Math?
PS You really shouldn't use Math as a variable name, that's a VBA class.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules