View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Macro using question to proceed or stop

Don't need a user form, a simple msgbox will do.

Sub foo()

Style = vbYesNo
msg = "are you sure you want to run macro?"
Response = MsgBox(msg, Style)
If Response = vbYes Then
If Response = vbNo Then Exit Sub

your code goes here

End If
End Sub


Gord Dibben MS Excel MVP

On Wed, 10 Oct 2007 17:35:21 -0700, mohavv wrote:

Hi,

I want to add a question to my macro if it is ok to run it or not (Are
you sure? Y/N).
So if you click yes it will proceed and if you click no it will stop.

I can't find out how to do this. Found Userform but I don't know how
to use it in a macro.

Any help pm this is welcome.

Cheers