View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
VMcD VMcD is offline
external usenet poster
 
Posts: 2
Default allow user to stop macro with yes no question

That's EXACTLY what I needed! Thanks so much for your quick reply.

"Simon Lloyd" wrote:


Try pointing your macro button at these!
Regards,
Simon.

sub lockcells()
if msgbox(\"you will not be able to make any more changes to this page.
are you sure you want to proceed?\", vbyesno, \"confirm decision\") =
vbno then
exit sub
cells.select
selection.locked = true
selection.formulahidden = false
range(\"a1\").select
activesheet.protect drawingobjects:=true, contents:=true,
scenarios:=true
activesheet.enableselection = xlnoselection
end sub

sub unlockcells()
if msgbox(\"you are about to unlock cells. are you sure you want to
proceed?\", vbyesno, \"confirm decision\") = vbno then
exit sub
activesheet.unprotect
cells.select
selection.locked = false
selection.formulahidden = false
range(\"a1\").select
end sub


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=571422