Deuce Bucksman
Board Regular
- Joined
- Jan 17, 2011
- Messages
- 102
Hello gurus!
I apologize if this is an asinine question, but is there anyone who could please tell me what I'm doing wrong with the code below. I'm trying to have the message box respond with a different message depending on which button the user selects (Yes/No). I tried to figure this out before coming to the board, but was unsuccessful. Everything works up until the ELSE statement. Thanks for your assistance.
Sub MacroTest1()
Dim x As Variant
Dim y As Variant
Dim answer As Variant
x = InputBox("Enter a number.", "Number entry one.")
y = InputBox("Enter another number.", "Number deuce.")
answer = WorksheetFunction.Sum(x, y)
MsgBox "Your answer is " & answer & "!", vbYesNo, "Your answer."
If vbYes Then
MsgBox ("Good times.")
Else: If vbNo Then MsgBox ("great times.")
End If
End Sub
I apologize if this is an asinine question, but is there anyone who could please tell me what I'm doing wrong with the code below. I'm trying to have the message box respond with a different message depending on which button the user selects (Yes/No). I tried to figure this out before coming to the board, but was unsuccessful. Everything works up until the ELSE statement. Thanks for your assistance.
Sub MacroTest1()
Dim x As Variant
Dim y As Variant
Dim answer As Variant
x = InputBox("Enter a number.", "Number entry one.")
y = InputBox("Enter another number.", "Number deuce.")
answer = WorksheetFunction.Sum(x, y)
MsgBox "Your answer is " & answer & "!", vbYesNo, "Your answer."
If vbYes Then
MsgBox ("Good times.")
Else: If vbNo Then MsgBox ("great times.")
End If
End Sub