ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Adding message window (https://www.excelbanter.com/excel-discussion-misc-queries/49304-adding-message-window.html)

Guido van Lammeren

Adding message window
 
Does anyone know if it possible (and how ofcourse) to make a pop-up message
window in excel that operates on the (Macro-)button. It has to contain a
choice option to operate the (macro-)button.

If the (macro-)button is used I want to make add a window which contains a
text saying:
"are you sure you want to delete the last year?"
CHOICHE OPTION: "YES" or "NO"

The macro will be run (and remove the appropriate collumns) if yes is
pressed and other wise return to the previous screen.

Dave Peterson

Dim Resp as long

resp = msgbox(Prompt:="Are you sure", buttons:=vbyesno)

if resp = vbyes then
'user hit yes
else
'user hit no
end if



Guido van Lammeren wrote:

Does anyone know if it possible (and how ofcourse) to make a pop-up message
window in excel that operates on the (Macro-)button. It has to contain a
choice option to operate the (macro-)button.

If the (macro-)button is used I want to make add a window which contains a
text saying:
"are you sure you want to delete the last year?"
CHOICHE OPTION: "YES" or "NO"

The macro will be run (and remove the appropriate collumns) if yes is
pressed and other wise return to the previous screen.


--

Dave Peterson

Chris Lavender

I assume by (Macro-)button you mean a command button inserted into the
sheet?

Sub Button1_Click()
Dim response As String
response = MsgBox("Are you sure you want to delete the last year?"",
vbYesNo, "Warning!")
If response = vbYes Then
[your macro]
End If
End Sub

Best rgds
Chris Lav

"Guido van Lammeren" <Guido van wrote in
message ...
Does anyone know if it possible (and how ofcourse) to make a pop-up

message
window in excel that operates on the (Macro-)button. It has to contain a
choice option to operate the (macro-)button.

If the (macro-)button is used I want to make add a window which contains a
text saying:
"are you sure you want to delete the last year?"
CHOICHE OPTION: "YES" or "NO"

The macro will be run (and remove the appropriate collumns) if yes is
pressed and other wise return to the previous screen.





All times are GMT +1. The time now is 10:01 PM.

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