Highlight text in a combo box?

razzandy

Active Member
Joined
Jun 26, 2002
Messages
390
Office Version
  1. 2007
Platform
  1. Windows
Can the text be highlighted in a combo box? You know like when you make a selection from the combo box list the text is highlighted blue. I want the text already selected when the combo box is loaded up. I need something like the below code:

Combobox1.Selected(Combobox1.Listcount)

Thanks in advance

Ryan A UK
:biggrin:
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Don't know if this would apply to a combobox, but this has worked for me in a textbox.
Code:
Private Sub UserForm_Activate()
TextBox1.Text = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
End Sub
 
Upvote 0
Thanks for that. That’s some useful code I didn’t know about!

Cheers


Ryan A UK
:biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,548
Messages
6,120,146
Members
448,948
Latest member
spamiki

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