Userform - ComboBox Formatting

vba_hugo

New Member
Joined
Aug 4, 2016
Messages
5
Good Morning,

Quick question, I want to bold the text of ComboBox1 when I select OptionButton1 but the following code is not working:

Code:
Sub ComboBox1_format()    If OptionButton1 = True Then
    ComboBox1.Text("Select a NAICS Code") = Bold
End Sub

How do I fix this?

Thanks
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try the following event handler for your option button...

Code:
Private Sub OptionButton1_Click()
    Me.ComboBox1.Font.Bold = True
End Sub

If you only want to bold the text in your combo box when the text equals "Select a NAICS Code", try the following instead...

Code:
[COLOR=darkblue]Private[/COLOR] [COLOR=darkblue]Sub[/COLOR] OptionButton1_Click()
    [COLOR=darkblue]If[/COLOR] Me.ComboBox1.Value = "Select a NAICS Code" [COLOR=darkblue]Then[/COLOR]
        Me.ComboBox1.Font.Bold = [COLOR=darkblue]True[/COLOR]
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
End [COLOR=darkblue]Sub[/COLOR]

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,215,752
Messages
6,126,672
Members
449,327
Latest member
John4520

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