add a warning before running a macro

  • Thread starter Thread starter Picman
  • Start date Start date
P

Picman

i have recorded a macro that clears the contents of the unprotected unlock
cells. i would like to have a message asking if the user is sure that they
want to clear the contents or not to. is this possible?
 
Option Explicit
Sub YourMacHere()
Dim resp as long
resp = msgbox(prompt:="Are you sure?", buttons:=vbyesno)
if resp = vbno then
exit sub
end if

'rest of your code
End Sub
 
thanks Dave, sorry i'm not all that experienced with these kinds of
modifications, how would i implement your code?
 
You have existing code for your macro, right?

You'd copy the guts that I wrote and paste it into your procedure--right near
the top, before anything really important.

Are the only lines you'd want to paste (without those > > symbols, of course).
 
That worked perfectly, thanks very much

Dave Peterson said:
You have existing code for your macro, right?

You'd copy the guts that I wrote and paste it into your procedure--right near
the top, before anything really important.


Are the only lines you'd want to paste (without those > > symbols, of course).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top