View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Elise148 Elise148 is offline
external usenet poster
 
Posts: 43
Default Msg Box in IF statement?

Thanks soo much! Again!

"Toppers" wrote:

just code the vbNO response and the macro will continue on the next statement

resp = MsgBox("Do you want to run the macro?", vbYesNo, Confirm)
If resp = vbNo Then
MsgBox ("Macro stopped.")
Exit Sub
End if

... macro continues here ...

HTH

"Elise148" wrote:

What if the IF statement is IN macro1? Will the "yes" part cause the IF
statement to run AGAIN in the macro? Is there a way to tell it to continue
with the macro, instead of run it from the beginning??


"Toppers" wrote:

If resp = vbYes Then
macro1 '<=== runs macro1
End If


"Elise148" wrote:

What if I want to run the whole macro if the answer is "Yes"...how do I end
the IF statement...right now it looks like...

resp = MsgBox("Do you want to run the macro?", vbYesNo, Confirm)
If resp = vbNo Then
MsgBox ("Macro stopped.")
Exit Sub

If resp = vbYes Then
Run = macro???????????
End If

"Toppers" wrote:


On a MsgBox you can set the YES,NO,CANCEL buttons in msgbox parameters...

resp=Msgbox(........,VbYESNO)

IF resp=vbYES then

IF resp=VbNO then

HTH

"Elise148" wrote:

How would I go about putting a Msg Box in an IF statement in VBA???

For example, I would want to say, if something is clicked in another message
box, proceed with the macro, if something else is clicked, stop the macro?????