Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
automatic macro update | Excel Worksheet Functions | |||
Date macro | Excel Discussion (Misc queries) | |||
Help with macro formula and variable | Excel Worksheet Functions | |||
Macro and If Statement | Excel Discussion (Misc queries) | |||
Macro for multiple charts | Excel Worksheet Functions |