This is my stupid, stupid VB code in Excel, can you tell me where I accidentalyed? :

Private Sub Main() intNum1 = Val(InputBox("Pleas enter the first operand", "First operand")) intNum2 = Val(InputBox("Pleas enter the Second operand", "Second operand")) strMathOperation = InputBox("+, -, *, or / for the math operation", "Math operation")

Call strAddUserInput(intNum1, intNum2, strMathOperation) SendResult End Sub

Private Function strAddUserInput(intNum1 As Integer, intNum2 As Integer, strMathOperation As String) As String

Advertisement

Select Case strMathOperation Case "+" strAddUserInput = intNum1 + intNum2 Case "-" strAddUserInput = intNum1 - intNum2 Case "*" strAddUserInput = intNum1 * intNum2 Case "/" strAddUserInput = intNum1 / intNum2 Case Else strAddUserInput = "Invalid math operation specified" End Select End Function Private Sub SendResult() MsgBox (Str("intNum1", "strMathOperation", "intNum2" & "strAddUserInput") = vbOKOnly) End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range) Call Main End Sub