MrExcel Publishing
Your One Stop for Excel Tips & Solutions

VBA Confimation

Posted by Phil on June 22, 2001 2:48 AM

I have a MACRO Called MakeNewPlan that basically deletes all of the unwanted cells...

However - the users are very trigger happy and seem to be pressing it willy nilly.

So it would like some sort of confimation box that say are you sure you want to clear the current plan. That if ok is pressed runs the MakeNewPlan MACRO and if cancel is pressed it exits.

Any1 know how i could do it...?



Posted by Dax on June 22, 2001 4:52 AM

Hello Phil,

You'll need to use the built in message box function. Something like this:-

Sub Confirmation()
Dim iAnswer As Integer

iAnswer = MsgBox("Are you sure you want to proceed?", vbYesNo, _
"Clear current plan?")
If iAnswer = vbYes Then
End If

End Sub

Sub MakeNewPlan()
'your macro
MsgBox "MakeNewPlan macro ran"
End Sub