VBA MsgBox code needed for skipping portion of code

dwilliamson1024

New Member
Joined
Dec 8, 2014
Messages
40
Good afternoon everyone.

I need to put in a pop up box in my VBA code to have it ask the user if they want to do something. They can click Yes or No
Yes: continues as normal
No: skips a section of the code

I did a few tries at this and keep getting an error. I know this is simple. Can someone please help me?? Thanks!!
 
Try this:

Code:
Continuewiththis = MsgBox(Prompt:="Do you want to continue with this?", Buttons:=vbQuestion + vbYesNo)
    If Continuewiththis = vbNo Then GoTo Skipthispart
'your code doing something
'end of your code doing something
Skipthispart:
'more of your code
'or end of Sub
 
Last edited:
Upvote 0
Glad it worked, and you're very welcome.
 
Upvote 0

Forum statistics

Threads
1,226,849
Messages
6,193,330
Members
453,790
Latest member
yassinosnoo1

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