Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Anthony
 
Posts: n/a
Default Macro asking "Are You Sure?"

Hi

I have a worksheet that contains several lines of data which I want the user
to be able to clear using a macro, which is easy enough but before the macro
actualy clears all the cells, is it possible to ask the user are they sure ??

any ideas ??

Thanks

Anthony
  #2   Report Post  
James
 
Posts: n/a
Default

Hi - you could use the this - replace the range A1:B2 with the cells you
want to delete

Sub Test()
Dim rng As Range
Dim var As Variant

Set rng = Range("A1:B2")

var = MsgBox("Are you sure you want to delete the following cells " _
& vbCr & vbCr & rng.Address, vbOKCancel + vbExclamation, _
"Delete Confirmation")

If var = vbOK Then
rng.ClearContents
End If

End Sub

"Anthony" wrote in message
...
Hi

I have a worksheet that contains several lines of data which I want the
user
to be able to clear using a macro, which is easy enough but before the
macro
actualy clears all the cells, is it possible to ask the user are they sure
??

any ideas ??

Thanks

Anthony



  #3   Report Post  
Anthony
 
Posts: n/a
Default

James,

Thanks, that works great !!

"Anthony" wrote:

Hi

I have a worksheet that contains several lines of data which I want the user
to be able to clear using a macro, which is easy enough but before the macro
actualy clears all the cells, is it possible to ask the user are they sure ??

any ideas ??

Thanks

Anthony

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
automatic macro update boconnell Excel Worksheet Functions 4 February 9th 05 07:10 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


All times are GMT +1. The time now is 12:08 AM.

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"