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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,223,155
Messages
6,170,405
Members
452,325
Latest member
BlahQz

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