Re: Inputbox not putting info in cell
Thank you it worked. Thank you both for the replies and help. Oh I'm so happy :D.
Re: Inputbox not putting info in cell
Thank you it worked. Thank you both for the replies and help. Oh I'm so happy :D.
Re: Inputbox not putting info in cell
I'm not sure if I understand. So should my code look like this:
Sub Auto_Open()
Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String
Dim Answer2 As String
Dim Question2 As String
Dim Answer3 As String
Dim Question3 As String
Dim Answer4 As String
Dim Question4 As String
Dim Answer5 As String
Dim Question5 As String
Dim Answer6 As String
Dim Question6 As String
Dim Answer7 As String
Dim Question7 As String
Dim Answer8 As String
Dim Question8 As String
Dim Response1 As String
Dim Response2 As String
QuestionToMessageBox = "Click Yes."
YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "DO AS I SAY")
If YesOrNoAnswerToMessageBox = vbNo Then
Question2 = "I would not have done that. Now your in trouble. Please try again."
Answer2 = MsgBox(Question2, vbYesNo, "Wrong Choice")
If Answer2 = vbYes Then
Question4 = "Much better but you're still under my wrath. Try anything and you will fail"
Answer4 = MsgBox(Question4, vbAbortRetryIgnore, "I'm So Evil")
If Answer4 = vbRetry Then
Question4 = "Much better but you're still under my wrath. Try anything and you will fail"
Answer4 = MsgBox(Question4, vbAbortRetryIgnore, "I'm So Evil")
ElseIf Answer4 = vbAbort Then
Question4 = "Much better but you're still under my wrath. Try anything and you will fail"
Answer4 = MsgBox(Question4, vbAbortRetryIgnore, "I'm So Evil")
End If
Else
Question6 = "Wow you are difficult. Now is your chance to go in the opposite direction." & vbNewLine & "Good luck at the next message box."
Answer6 = MsgBox(Question6, vbYesNo, "You asked for it")
If Answer6 = vbNo Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
If Answer8 = vbRetry Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
ElseIf Answer8 = vbAbort Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
End If
Else
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
If Answer8 = vbRetry Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
ElseIf Answer8 = vbAbort Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
End If
End If
End If
Else
Question3 = "Sorry I lied. Click 'No' this time"
Answer3 = MsgBox(Question3, vbYesNo, "Hahahahahaha")
If Answer3 = vbNo Then
Question5 = "Cool. I didn't think you were actually going to click it." & vbNewLine & "What do you want to do know?(Choose at your own risk.)"
Answer5 = MsgBox(Question5, vbAbortRetryIgnore, "Let's see what happens to you")
If Answer5 = vbRetry Then
Question5 = "Cool. I didn't think you were actually going to click it." & vbNewLine & "What do you want to do know?(Choose at your own risk)"
Answer5 = MsgBox(Question5, vbAbortRetryIgnore, "Let's see what happens to you")
ElseIf Answer5 = vbAbort Then
Question5 = "Cool. I didn't think you were actually going to click it." & vbNewLine & "What do you want to do know?(Choose at your own risk)"
Answer5 = MsgBox(Question5, vbAbortRetryIgnore, "Let's see what happens to you")
End If
Else
Question7 = "Now your catching on. Try this." & vbNewLine & "Don't click 'No' or 'Yes'."
Answer7 = MsgBox(Question7, vbYesNoCancel, "Good Luck")
If Answer7 = vbNo Then
MsgBox "Hooray!!! You win."
ElseIf Answer7 = vbYes Then
MsgBox "Hooray!!!! You win."
End If
End If
End If
Response1 = Application.InputBox("Congradulations.You have completed the annoying game." & vbNewLine & "Please enter your name.", "Survey", "Enter Name Here", Type:=2)
If Response <> False Then
Worksheets(1).Range("A1").Value = Application.InputBox("Congradulations.You have completed the annoying game." & vbNewLine & "Please enter your name.", "Survey", "Enter Name Here", Type:=2)
End If
Response2 = Application.InputBox("Be honest now, did you like this annoying game?", "Survey", "Enter 'Yes' or 'No' Here", Type:=2)
If Response <> False Then
Workbooks(Survey).Worksheets(1).Range("B1").Value = Application.InputBox("Be honest now, did you like this annoying game?", "Survey", "Enter 'Yes' or 'No' Here", Type:=2)
End If
End Sub
Display More
But I'm not sure where I'm supposed to put the with part.
Re: Inputbox not putting info in cell
So how come it still doesn't input anything in the cell when I type something in the input box?
Re: Inputbox not putting info in cell
What are considered to be values? Like anything or just numbers or only text.
Re: Inputbox not putting info in cell
No luck with that.
Hi everyone,
My code is just a bunch of msgbox but at the end I have two InputBoxes. I want the info that is typed in those Inputboxes to be put in the active worksheet but it does not work. How can I execute this. Thanks for the help in advanced.
My Code
Sub Auto_Open()
Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String
Dim Answer2 As String
Dim Question2 As String
Dim Answer3 As String
Dim Question3 As String
Dim Answer4 As String
Dim Question4 As String
Dim Answer5 As String
Dim Question5 As String
Dim Answer6 As String
Dim Question6 As String
Dim Answer7 As String
Dim Question7 As String
Dim Answer8 As String
Dim Question8 As String
Dim Response1 As String
Dim Response2 As String
QuestionToMessageBox = "Click Yes."
YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "DO AS I SAY")
If YesOrNoAnswerToMessageBox = vbNo Then
Question2 = "I would not have done that. Now your in trouble. Please try again."
Answer2 = MsgBox(Question2, vbYesNo, "Wrong Choice")
If Answer2 = vbYes Then
Question4 = "Much better but you're still under my wrath. Try anything and you will fail"
Answer4 = MsgBox(Question4, vbAbortRetryIgnore, "I'm So Evil")
If Answer4 = vbRetry Then
Question4 = "Much better but you're still under my wrath. Try anything and you will fail"
Answer4 = MsgBox(Question4, vbAbortRetryIgnore, "I'm So Evil")
ElseIf Answer4 = vbAbort Then
Question4 = "Much better but you're still under my wrath. Try anything and you will fail"
Answer4 = MsgBox(Question4, vbAbortRetryIgnore, "I'm So Evil")
End If
Else
Question6 = "Wow you are difficult. Now is your chance to go in the opposite direction." & vbNewLine & "Good luck at the next message box."
Answer6 = MsgBox(Question6, vbYesNo, "You asked for it")
If Answer6 = vbNo Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
If Answer8 = vbRetry Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
ElseIf Answer8 = vbAbort Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
End If
Else
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
If Answer8 = vbRetry Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
ElseIf Answer8 = vbAbort Then
Question8 = "You should have just listened to me in the first place"
Answer8 = MsgBox(Question8, vbAbortRetryIgnore, "You Asked For It")
End If
End If
End If
Else
Question3 = "Sorry I lied. Click 'No' this time"
Answer3 = MsgBox(Question3, vbYesNo, "Hahahahahaha")
If Answer3 = vbNo Then
Question5 = "Cool. I didn't think you were actually going to click it." & vbNewLine & "What do you want to do know?(Choose at your own risk.)"
Answer5 = MsgBox(Question5, vbAbortRetryIgnore, "Let's see what happens to you")
If Answer5 = vbRetry Then
Question5 = "Cool. I didn't think you were actually going to click it." & vbNewLine & "What do you want to do know?(Choose at your own risk)"
Answer5 = MsgBox(Question5, vbAbortRetryIgnore, "Let's see what happens to you")
ElseIf Answer5 = vbAbort Then
Question5 = "Cool. I didn't think you were actually going to click it." & vbNewLine & "What do you want to do know?(Choose at your own risk)"
Answer5 = MsgBox(Question5, vbAbortRetryIgnore, "Let's see what happens to you")
End If
Else
Question7 = "Now your catching on. Try this." & vbNewLine & "Don't click 'No' or 'Yes'."
Answer7 = MsgBox(Question7, vbYesNoCancel, "Good Luck")
If Answer7 = vbNo Then
MsgBox "Hooray!!! You win."
ElseIf Answer7 = vbYes Then
MsgBox "Hooray!!!! You win."
End If
End If
End If
Response1 = Application.InputBox("Congradulations.You have completed the annoying game." & vbNewLine & "Please enter your name.", "Survey", "Enter Name Here", Type:=2)
If Response <> False Then
Worksheets(1).Range("A1").String = Response1
End If
Response2 = Application.InputBox("Be honest, did you like this annoying game?", "Survey", "Enter 'Yes' or 'No' Here", Type:=2)
If Response <> False Then
Worksheets(1).Range("B1").String = Response2
End If
End Sub
Display More
Thanks Again.
Re: Yes or No Msgbox not working
Now it makes sense. Thank you norie and Wigi for the help.
Hi all,
Sub Auto_Open()
Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String
QuestionToMessageBox = "Click Yes."
YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "DO AS I SAY")
If YesOrNoAnswerToMessageBox = vbNo Then
MsgBox "I would not have done that. Now your in trouble. Please try again.", vbYesNo
If YesOrNoAnswerToMessageBox = vbNo Then
MsgBox "Wow you are difficult. Now is your chance to go in the opposite direction.", vbYesNo
Else
MsgBox "Much better but you're still under my wrath. Try anything and you will fail", vbYesNo
End If
Else
MsgBox "Sorry I lied. Click 'No' this time", vbYesNo, "Hahahahahaha"
If YesOrNoAnswerToMessageBox = vbNo Then
MsgBox "Cool. I didn't think you were actually going to click it."
Else
MsgBox "Now your catching on."
End If
End If
End Sub
Display More
Now for the problem. Every time I get to the second msgbox and click either yes or no, it only shows this line in the third msgbox:
"Wow you are difficult. Now is your chance to go in the opposite direction."
Any thoughts why? (Sorry if confusing)
Re: Include Cell Value In MsgBox
I found out the problem and what I had to do was also reference the workbook so now this is what it looks like,
[MsgBox "You have" & Workbooks("Personal.xlsb").Sheets("YourSheetNameHere").Range("B1").Value & " days left till your birthday Ryan!"]
Thank you though for your part.
Re: Include Cell Value In MsgBox
It only works if the workbook is not hidden but when I hide the workbook it does not work.
Re: Include Cell Value In MsgBox
Thanks for the reply but still no luck.
Hi. I'm pretty new to Excel VBA and I keep getting this error: Method 'Range' of 'object' Global Failed
Here's my code and I don't know what is wrong.
Private Sub Auto_Open()
Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String
QuestionToMessageBox = "Tip top of the morning to you Ryan." & vbNewLine & "Is your day going good?"
YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "Good Morning")
If YesOrNoAnswerToMessageBox = vbNo Then
MsgBox "Sorry to know that. Here's a joke for you." & vbNewLine & "" & vbNewLine & "What's smart and can do a lot of things but doesn't go to school?" & vbNewLine & " Your computer!"
Else
MsgBox "Great! Have a nice day now."
End If
MsgBox "You have" & Range("B1") & " days left till your birthday Ryan!"
End Sub
Display More
Thanks in advance.