Microsoft Excel Question:

Can I ask my user for confirmation before executing the macro?

Tweet Share WhatsApp

Answer:

Sub AskAndDo()
If MsgBox("Are you sure ?", vbYesNo + vbQuestion) = vbNo _
Then Exit Sub
'Code goes here instead of
MsgBox "Actions here"
End Sub

Download MS Excel PDF Read All 143 MS Excel Questions
Previous QuestionNext Question
My Stop Recording toolbar has disappeared. How do I get it back?Can I have my Macro make Excel NOT ask "the file already exists, do you want to overwrite" type of questions?