Option boxes..

Ste_Moore01

Active Member
Joined
Jul 13, 2005
Messages
467
Hi guys,

I'm trying to create a box that is similar to a msgbox but instead of there being just one button (the "OK" button) I want there to be 2 buttons and each button does something different.

Is there a way of doing this as I'm not sure how to do it.

I would like the text in the box to say, "Do you wish to Print this pricepack?" and the buttons to say "Yes" and "No".

The "Yes" button would run the macro "Pricepack" and the "No" button would run the macro "Pricepack1".
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Example:

Code:
Sub Test()
    Dim Ans As Variant
    Ans = MsgBox("Do you wish to Print this pricepack?", vbYesNo)
    If Ans = vbYes Then
'       Your code
    Else
'       Your code
    End If
End Sub
 
Upvote 0
Try this...

Code:
If MsgBox("Do you want to Print ?", vbYesNo, "Printing") = vbYes Then
    'Run This code
Else
    'Run this code
End If

Bob
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top