Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 42
Default Simple Yes / No messagebox followed by an if then else formula

Hi there

Created a macro that clears a spreadsheet, and have put in a button that
runs it once clicked. Now all I want is a simple yes/no/cancel option to come
up that, once the button is clicked, the user can still cancel before the
macro runs, unless he is happy to go with it in which case all the data will
be cleared.
Pretty simple I'm sure, but I have no idea how to launch the messagebox, and
then based on the yes / no click to run the macro or not?!?

Any thoughts?

Thanks,
mike
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 533
Default Simple Yes / No messagebox followed by an if then else formula

If MsgBox("Proceed?", vbYesNo, "Clear sheet") = vbYes Then
'Clear code
End If


--
Jim
"mike_vr" wrote in message
...
| Hi there
|
| Created a macro that clears a spreadsheet, and have put in a button that
| runs it once clicked. Now all I want is a simple yes/no/cancel option to
come
| up that, once the button is clicked, the user can still cancel before the
| macro runs, unless he is happy to go with it in which case all the data
will
| be cleared.
| Pretty simple I'm sure, but I have no idea how to launch the messagebox,
and
| then based on the yes / no click to run the macro or not?!?
|
| Any thoughts?
|
| Thanks,
| mike


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 284
Default Simple Yes / No messagebox followed by an if then else formula

Here is an option that will give you the options 'ok' and 'cancel'. Take a
look at help for Msgbox if you need yes/no or yes/no/cancel.

x = MsgBox("Do you want to run me", vbOKCancel, _
"Approval Option")
If x = 2 Then
Exit Sub
Else
' your code to run goes here
End If


Steve Yandl



"mike_vr" wrote in message
...
Hi there

Created a macro that clears a spreadsheet, and have put in a button that
runs it once clicked. Now all I want is a simple yes/no/cancel option to
come
up that, once the button is clicked, the user can still cancel before the
macro runs, unless he is happy to go with it in which case all the data
will
be cleared.
Pretty simple I'm sure, but I have no idea how to launch the messagebox,
and
then based on the yes / no click to run the macro or not?!?

Any thoughts?

Thanks,
mike



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
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Help with MessageBox coding for newbie Mac1 Excel Worksheet Functions 1 February 8th 07 06:25 PM
messagebox in excel 2003 Brett17 Excel Discussion (Misc queries) 1 November 28th 06 08:00 AM
Printing messagebox nc Excel Discussion (Misc queries) 1 March 22nd 05 02:49 PM


All times are GMT +1. The time now is 04:05 PM.

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

About Us

"It's about Microsoft Excel"