ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "If Yes then Proceed..." Macro (https://www.excelbanter.com/excel-programming/366129-if-yes-then-proceed-macro.html)

bman342

"If Yes then Proceed..." Macro
 
I need a simple Yes/No dialog box.
If the User clicks "Yes" it runs a macro that I have already recorded.
If "No" it closes the macro.

Is there a trusted public library of these types of basic macros somewhere?

Thanks so much.

Norman Jones

"If Yes then Proceed..." Macro
 
Hi Bman342,

Try:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to run the Macro?", _
Buttons:=vbYesNo + vbQuestion)

If res = vbNo Then Exit Sub

'Your code

End Sub
'<<=============


---
Regards,
Norman



"bman342" wrote in message
...
I need a simple Yes/No dialog box.
If the User clicks "Yes" it runs a macro that I have already recorded.
If "No" it closes the macro.

Is there a trusted public library of these types of basic macros
somewhere?

Thanks so much.




Ardus Petus

"If Yes then Proceed..." Macro
 
dim vRep as Variant
vRep = Msgbox("Do you want to continue",vbYesNo)
if vRep = vbYes then
<do something
end if

HTH
--
AP

"bman342" a écrit dans le message de
news: ...
I need a simple Yes/No dialog box.
If the User clicks "Yes" it runs a macro that I have already recorded.
If "No" it closes the macro.

Is there a trusted public library of these types of basic macros
somewhere?

Thanks so much.




Norman Jones

"If Yes then Proceed..." Macro
 
Hi Bman342,

Alternatively, try:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to run the Macro?", _
Buttons:=vbYesNo + vbQuestion)

If res = vbYes Then
Call myMacro
End If

End Sub
'<<=============


---
Regards,
Norman


"bman342" wrote in message
...
I need a simple Yes/No dialog box.
If the User clicks "Yes" it runs a macro that I have already recorded.
If "No" it closes the macro.

Is there a trusted public library of these types of basic macros
somewhere?

Thanks so much.




witek

"If Yes then Proceed..." Macro
 
bman342 wrote:
I need a simple Yes/No dialog box.
If the User clicks "Yes" it runs a macro that I have already recorded.
If "No" it closes the macro.

Is there a trusted public library of these types of basic macros somewhere?

Thanks so much.



if MsgBox ("Message", vbYesNo) = vbYes then

.... macro

end if

Moose[_2_]

"If Yes then Proceed..." Macro
 

bman342 wrote:
I need a simple Yes/No dialog box.
If the User clicks "Yes" it runs a macro that I have already recorded.
If "No" it closes the macro.

Is there a trusted public library of these types of basic macros somewhere?

Thanks so much.


Try This:

Msg = MsgBox("Your Question For User",vbYesNo,)
If Msg = vbNo Then Exist Sub
If Msg = vbYes Then Your Macro


bman342

"If Yes then Proceed..." Macro
 
Works fine. Much thanks to both.

"Norman Jones" wrote:

Hi Bman342,

Alternatively, try:

'=============
Public Sub Tester()
Dim res As VbMsgBoxResult

res = MsgBox(Prompt:="Do you wish to run the Macro?", _
Buttons:=vbYesNo + vbQuestion)

If res = vbYes Then
Call myMacro
End If

End Sub
'<<=============


---
Regards,
Norman


"bman342" wrote in message
...
I need a simple Yes/No dialog box.
If the User clicks "Yes" it runs a macro that I have already recorded.
If "No" it closes the macro.

Is there a trusted public library of these types of basic macros
somewhere?

Thanks so much.






All times are GMT +1. The time now is 03:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com