Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2
Default How do I create a warning message on a command button

I am a newbie to anything above basic level in Excel. I know how to create
and use Command Buttons, but I need to create a "Warning! Are You Sure"
message when you click the button, with "Yes", "No", and "Cancel" options.
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 897
Default How do I create a warning message on a command button

The code is

MsgBox "Warning! Are You Sure", vbYesNoCancel

But you'll want it to be part of a conditional statement, for example

If MsgBox("Warning! Are You Sure", vbYesNoCancel) = vbYes Then
Exit Sub
End If


HTH

On Jan 23, 4:13*am, lkreeder
wrote:
I am a newbie to anything above basic level in Excel. *I know how to create
and use Command Buttons, but I need to create a "Warning! Are You Sure"
message when you click the button, with "Yes", "No", and "Cancel" options..


  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,934
Default How do I create a warning message on a command button

JP has given you an answer which should get you started. However, I have a
question... what is the difference between the user answering No and them
answering Cancel?

--
Rick (MVP - Excel)


"lkreeder" wrote in message
...
I am a newbie to anything above basic level in Excel. I know how to create
and use Command Buttons, but I need to create a "Warning! Are You Sure"
message when you click the button, with "Yes", "No", and "Cancel" options.


  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2
Default How do I create a warning message on a command button

Thanks, JP. Worked like a charm. Maybe I need to buy one of those thick books
to learn this stuff.....

"JP" wrote:

The code is

MsgBox "Warning! Are You Sure", vbYesNoCancel

But you'll want it to be part of a conditional statement, for example

If MsgBox("Warning! Are You Sure", vbYesNoCancel) = vbYes Then
Exit Sub
End If


HTH

On Jan 23, 4:13 am, lkreeder
wrote:
I am a newbie to anything above basic level in Excel. I know how to create
and use Command Buttons, but I need to create a "Warning! Are You Sure"
message when you click the button, with "Yes", "No", and "Cancel" options..



  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 897
Default How do I create a warning message on a command button

Glad to hear it, but I think I actually typed it wrong, it should be

If MsgBox("Warning! Are You Sure", vbYesNo) = vbNo Then
Exit Sub
End If

because you want to exit if the user clicks "No". Also I agree with
Rick that No and Cancel basically mean the same thing, so Cancel is
unnecessary.

HTH


On Jan 24, 4:04*am, lkreeder
wrote:
Thanks, JP. Worked like a charm. Maybe I need to buy one of those thick books
to learn this stuff.....

"JP" wrote:
The code is


MsgBox "Warning! Are You Sure", vbYesNoCancel


But you'll want it to be part of a conditional statement, for example


If MsgBox("Warning! Are You Sure", vbYesNoCancel) = vbYes Then
* Exit Sub
End If


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create a command button, then assign macro to it in excel kshaheen Excel Discussion (Misc queries) 3 June 24th 08 01:03 PM
how to create attachment command button gbpg Excel Discussion (Misc queries) 0 August 15th 07 02:44 PM
How to create a link by using command button in VB Dav Excel Discussion (Misc queries) 1 March 9th 06 12:23 PM
How to create command button to save the dates and time Ken Vo Excel Discussion (Misc queries) 6 January 5th 06 04:18 AM
How to Create a Command Button Jason Excel Discussion (Misc queries) 1 October 12th 05 09:50 PM


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"