Help! Highlighting text in combo box

sagain2k

Board Regular
Joined
Sep 8, 2002
Messages
94
I created a Combo Box with a drop-down list that works fine at this point, but I would like the text in the box to appear highlighted, so that the user can just start typing to replace that value if desired.

As it is now, the first entry appears non-highlighted, and you have to double-click it to highlight it. You can press the Down Arrow to scroll through the choices, and then either press Enter, Tab, or Down Arrow to go to the next field in the form.

The initialization code for the form is below. What code will cause the text to be highlighted? Thanks!!

--Ray

Private Sub UserForm_Initialize()

CboxCategory.AddItem "CCCA"
CboxCategory.AddItem "Architect"
CboxCategory.AddItem "Contractor"
CboxCategory.SetFocus
CboxCategory.ListIndex = 0

End Sub
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

sagain2k

Board Regular
Joined
Sep 8, 2002
Messages
94
I tried changing the Style as you suggested...still have the same result: it shows the first entry in the list but not highlighted. I can live with having to double-click it first, but it would be nice to have it already highlighted when the form first comes up. Thanks for the response!
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
It worked for me.

With Style fmStyleDropDownCombo it is white with an insertion character at the end. With Style fmStyleDropDownList it is highlighted blue.
 

Forum statistics

Threads
1,144,510
Messages
5,724,784
Members
422,579
Latest member
Lekha mohanty

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