Yes No Print Msgbox Macro

boldcode

Active Member
Joined
Mar 12, 2010
Messages
347
Hi,

I just need a little help in setting up this Yes/No message box just right. If the user answers 'NO' to my question then I want to return to worksheet "TOC". If the user answers 'Yes' then I want the macro to resume with the rest of the statements that come after the message box.

This is my current code:
Sub YesNoPrintMessageBox()
Dim Answer As String
Dim MyQuestion As String

MyQuestion = "Do you still want to print this report?"

Display MessageBox
Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "???")

If Answer = vbNo Then

(this is not code: IF THE ANSWER IS "NO" THEN I WANT TO RETURN TO Worksheet "TOC")

Else

(this is not code: IF THE ANSWER IS "YES" THEN I WANT THE MACRO TO RESUME WITH THE REST OF THE STATEMENTS THAT COME AFTER THE Msgbox)

End If

End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
how about

Code:
[FONT=Arial]Sub YesNoPrintMessageBox()
Dim Answer As String
Dim MyQuestion As String

MyQuestion = "Do you still want to print this report?"

Display MessageBox
Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "???")

If Answer = vbNo Then
[/FONT][FONT=Arial]
(this is not code: IF THE ANSWER IS "NO" THEN I WANT TO RETURN TO Worksheet "TOC")[/FONT]
[FONT=Arial][/FONT] 
[FONT=Arial][COLOR=seagreen]Worksheet("TOC").Activate
End[/COLOR]


Else

(this is not code: IF THE ANSWER IS "YES" THEN I WANT THE MACRO TO RESUME WITH THE REST OF THE STATEMENTS THAT COME AFTER THE Msgbox)

End If

End Sub [/FONT]
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,558
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top