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".
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,799
Messages
5,574,387
Members
412,590
Latest member
Velly
Top