Asking the user to see if he really wants to run the code...

sssb2000

Well-known Member
Joined
Aug 17, 2004
Messages
1,169
hi,
is there anyway i could pop a message asking the user:

"Do you really want to run the code?" and if it says yes, continue on with running the code and if it says no, the code exits.


?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

martinee

Well-known Member
Joined
Nov 4, 2003
Messages
960
Try this:
Code:
Sub AskUser()

ans = MsgBox( _
            Prompt:="Are you sure you would like to proceed?", _
            Buttons:=vbYesNo, _
            Title:="Are you sure")
            
If ans = vbNo Then Exit Sub

'finish your code here
End Sub
HTH.
 

sssb2000

Well-known Member
Joined
Aug 17, 2004
Messages
1,169
Re: Asking the user to see if he really wants to run the cod

:)
thank you very much,
that works Great! :)

have an awesome day!
 

Forum statistics

Threads
1,148,525
Messages
5,747,206
Members
424,068
Latest member
Salim khamis

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
Top