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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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
 

staticbob

Well-known Member
Joined
Oct 7, 2003
Messages
1,079
Try this...

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

Bob
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,835
Messages
5,855,909
Members
431,772
Latest member
dannyboi1

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
Top