View Single Post
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Pank,

If MsgBox("You have selected " _
& ActiveSheet.Name & " to be cleared out, are you sure?", _
vbYesNo) = vbYes Then
MsgBox "I'm going to clear it now!"
'You code to clear sheet here
Else
MsgBox "Good thing you changed your mind!"
End If

HTH,
Bernie
MS Excel MVP


"Pank Mehta" wrote in message
...
I have a macro that will clear out data from a sheet. To ensure that the
sheet is not cleared out in error I want to use a message box to ask the
question 'Are you sure that you want to clear out the data?'.

If the answer is Yes I want the macro to run, if the answer is No, then
nothing should be done.

Additionally, is there a way to display the selected sheet name within the
message box? (i.e. You have selected <sheet name to be cleared out, are

you
sure?).

Any help would be appreciated.