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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

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,531
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,122,850
Messages
5,598,441
Members
414,240
Latest member
xnanx

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