Thursday, March 10, 2011

How to make a Yes or No macro in Excel

There may be times when your Excel spreadsheet will want users to click a "Yes" or "No" button. To do this simply insert this line of VBA code. Tthe Select Case statement is used in this example.
YesNo = MsgBox("This macro will ... Do you want to continue?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes
'Insert your code here if Yes is clicked
Case vbNo
'Insert your code here if No is clicked
End Select

1 comment:

  1. nice, I use it too for my job,
    http://fiverr.com/users/h2nrlc/gigs/create-macro-with-userform-in-excel

    ReplyDelete

I'd love to hear from you!
-Nick