Option Boxes

Ste_Moore01

Active Member
Joined
Jul 13, 2005
Messages
467
Hi,

I'm trying to make a box like a with 2 options like a "Yes/No" box.

Is there a way of making a box like this but instead of having "Yes" and "No" can you replace these with different words?
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Using the MsgBox function, you can have the following Buttons:

vbOKOnly 0 Display OK button only.
vbOKCancel 1 Display OK and Cancel buttons.
vbAbortRetryIgnore 2 Display Abort, Retry, and Ignore buttons.
vbYesNoCancel 3 Display Yes, No, and Cancel buttons.
vbYesNo 4 Display Yes and No buttons.
vbRetryCancel 5 Display Retry and Cancel buttons

Using a UserForm you can have whatever Buttons you want.
 

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
How about option buttons. One way ....
Open the Forms toolbar and draw a "Group box" on the sheet.
Draw some Option Buttons inside the box. Only one of the option buttons inside the box can be "live".

If you hold down the Ctrl key and right-click on an Option Button (etc) you can change the properties (Format Control) as well as the text that shows.

To select more than one use Ctrl+Shift. You can then change the Cell Link property of the set to the same cell, which will indicate which one is selected.
 

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,402
Do you mean a MsgBox? If so, what do you want on the buttons? Does that option exist when you look at the help for MsgBox?
 

Ste_Moore01

Active Member
Joined
Jul 13, 2005
Messages
467

ADVERTISEMENT

I would like a MsgBox to appear that says, "Is this an Electrical or Plumbing wholesaler?" and the options would be "Electrical Wholsaler" and "Plumbing Wholesaler".

I am able to make the MsgBox with the options that Andrew Poulsom stated but I was hoping to change them.
 

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
The message box method does not allow many choices. I would handle something like this :-
Code:
Sub test()
    rsp = MsgBox("Is this an Electrical (or Plumbing) Wholesaler ?" & vbCr _
        & "'Yes' for Electrical" & vbCr _
        & "'No' for Plumbing", vbYesNoCancel)
    If rsp = vbYes Then
        ' "yes" code here
    ElseIf rsp = vbNo Then
        ' "no" code here
    Else
        Exit Sub
    End If
End Sub
 

Ste_Moore01

Active Member
Joined
Jul 13, 2005
Messages
467
Thanks for the suggestion.

I'll have to do it that way if there are no others.

Thanks again!
 

Watch MrExcel Video

Forum statistics

Threads
1,118,812
Messages
5,574,457
Members
412,595
Latest member
slim313
Top