Answer Message Box - Other than Y/N?

J

jday

I would like to include a message box to my macro that prompts user to select
one of two options, or to CANCEL. I know you can create an Answer Box that
provides a Y/N/Cancel option, but I really don't want to use "YES" or "NO".
For example, I'd like the message to say "Would you like to copy your data to
SHEET1 or SHEET2?" Then have buttons labeled SHEET1 / SHEET2 /CANCEL
(instead of YES / NO / CANCEL). Can this be done?
 
M

Mike

You need to create a userform to do what you want. Then on your userform put
a listbox with sheetnames and then the user could select the sheetname from
the listbox and hit ok.
 
S

SteAXA

MsgBox(prompt[, buttons] [, title] [, helpfile, context])

In buttons you can use VbYesNoCancel
if user select:
yes msgbox return vbYes (=6),
no msgbox return vbNo (=7),
cancel msgnox return vbCancel (=2).

Ste'
 
R

Rick Rothstein

Or, for the three options the OP asked about, he could use three
CommandButtons in place of the ListBox.
 
M

Mike

Your right. I was giving another option. So that maybe in the future the user
would like to paste to worksheet 3 or 4 or 5 ect... the user would not have
to modify the userform.
 
E

eliano

MsgBox(prompt[, buttons] [, title] [, helpfile, context])

In buttons you can use VbYesNoCancel
if user select:
yes msgbox return vbYes (=6),
no msgbox return vbNo (=7),
cancel msgnox return vbCancel (=2).

Ste'

Like this ?

Dim reply As VbMsgBoxResult
reply = MsgBox("Yes = Copy data in Sheet1" & _
vbNewLine & _
"No = Copy data in Sheet2" & _
vbNewLine & _
" otherwise Cancel", _
vbYesNoCancel)

Ciao
:-8)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top