ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Warning Message before a Macro is Run (https://www.excelbanter.com/excel-programming/379226-warning-message-before-macro-run.html)

amirstal

Warning Message before a Macro is Run
 
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.


Brian

Warning Message before a Macro is Run
 
The following code will ask the user if they want to continue, and if
they choose not to, it will end the macro. This needs to be placed at
the top of the macro when you "edit" the macro. If you need help doing
that, write back.


if msgbox("Are you sure that you want to run this macro?",vbyesno, "Are
you sure?") = vbno then
exit sub
end if




On Dec 11, 10:06 pm, "amirstal" wrote:
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.



amirstal

Warning Message before a Macro is Run
 
Thanks Brian,

It did not work...
Here is how I tried:

Sub cleanblotter()
'
' cleanblotter Macro
' Macro recorded 12/11/2006 by Reuters LTD
' ifmsgbox("Are you sure that you want to clean the
blotter?",vbyesno,"Are you sure?")=vbno then
Exit Sub
End If

Range("AN19").copy
Range("AL19").PasteSpecial xlPasteValues

Range("A11:A1000,B11:B1000,D11:D1000,E11:E1000,G11 :G1000,I11:I1000,J11:J1000,K11:K1000").Select
Range("I11").Activate
Selection.ClearContents
Range("A11").Select

End Sub


Amir


Brian wrote:
The following code will ask the user if they want to continue, and if
they choose not to, it will end the macro. This needs to be placed at
the top of the macro when you "edit" the macro. If you need help doing
that, write back.


if msgbox("Are you sure that you want to run this macro?",vbyesno, "Are
you sure?") = vbno then
exit sub
end if




On Dec 11, 10:06 pm, "amirstal" wrote:
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.



[email protected][_2_]

Warning Message before a Macro is Run
 

amirstal wrote:
Thanks Brian,

It did not work...
Here is how I tried:

Sub cleanblotter()
'
' cleanblotter Macro
' Macro recorded 12/11/2006 by Reuters LTD
' ifmsgbox("Are you sure that you want to clean the
blotter?",vbyesno,"Are you sure?")=vbno then
Exit Sub
End If

Range("AN19").copy
Range("AL19").PasteSpecial xlPasteValues

Range("A11:A1000,B11:B1000,D11:D1000,E11:E1000,G11 :G1000,I11:I1000,J11:J1000,K11:K1000").Select
Range("I11").Activate
Selection.ClearContents
Range("A11").Select

End Sub


Amir


Brian wrote:
The following code will ask the user if they want to continue, and if
they choose not to, it will end the macro. This needs to be placed at
the top of the macro when you "edit" the macro. If you need help doing
that, write back.


if msgbox("Are you sure that you want to run this macro?",vbyesno, "Are
you sure?") = vbno then
exit sub
end if




On Dec 11, 10:06 pm, "amirstal" wrote:
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.



Bob Phillips

Warning Message before a Macro is Run
 
Sub cleanblotter()
'
' cleanblotter Macro
' Macro recorded 12/11/2006 by Reuters LTD
' If MsgBox("Are you sure that you want to clean the blotter?", _
vbyesno,"Are you sure?")=vbno then Exit Sub

Range("AN19").copy
Range("AL19").PasteSpecial xlPasteValues

Range("A11:A1000,B11:B1000,D11:D1000,E11:E1000,G11 :G1000,I11:I1000,J11:J1000,K11:K1000").ClearConten ts
Range("A11").Select

End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"amirstal" wrote in message
ups.com...
Thanks Brian,

It did not work...
Here is how I tried:

Sub cleanblotter()
'
' cleanblotter Macro
' Macro recorded 12/11/2006 by Reuters LTD
' ifmsgbox("Are you sure that you want to clean the
blotter?",vbyesno,"Are you sure?")=vbno then
Exit Sub
End If

Range("AN19").copy
Range("AL19").PasteSpecial xlPasteValues

Range("A11:A1000,B11:B1000,D11:D1000,E11:E1000,G11 :G1000,I11:I1000,J11:J1000,K11:K1000").Select
Range("I11").Activate
Selection.ClearContents
Range("A11").Select

End Sub


Amir


Brian wrote:
The following code will ask the user if they want to continue, and if
they choose not to, it will end the macro. This needs to be placed at
the top of the macro when you "edit" the macro. If you need help doing
that, write back.


if msgbox("Are you sure that you want to run this macro?",vbyesno, "Are
you sure?") = vbno then
exit sub
end if




On Dec 11, 10:06 pm, "amirstal" wrote:
Is there a way to have a warning message pop-up before a macro is
applied (i.e., once you press the macro button, the warning will appear
and ask for a second confirmation of the process before it starts...)?

Thanks.






All times are GMT +1. The time now is 07:31 PM.

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