Confirm a choice before Macro
Option Explicit
Sub clearAll()
Dim Resp as long
resp = msgbox(Prompt:="Are you sure???",buttons:=vbyesno)
if resp = vbyes then
activesheet.Range("D3,...M48").ClearContents
end if
End Sub
JSnow wrote:
I have a macro attached to a button that will clear all data on a page. I'd
like there to be a confirmation (that's how I know it from javascript) to
preceed the macro. Here's the code thus far:
Sub clearAll()
Range("D3,...M48").ClearContents
End Sub
Is there something I can throw in the macro, before the Range line that will
ask, "Are you sure you want to delete all data?" If yes then fire macro, if
no then end.
Thanks, JSnow
--
Dave Peterson
|