Enter text in a Combobox

A

aftamath77

Is it possible to allow a user to enter a "not list" item into a VB userform
combobox?

I found this website saying that there are three types of comboboxes:
http://www.vb6.us/tutorials/visual-basic-combo-box-tutorial

It says that a type 0 combobox allows a user to enter values in the textbox
portion of the combobox. Is this correct and how do I code the combobox to
allow this?
 
D

Dave Peterson

You can change the .Style property of the combobox.

Open the VBE
Select your userform
Select the Combobox
Hit F4 to see the properties window

Scroll down to the Style property and choose the one you want.

But you'll only see two styles in VBA. It's different from VB.

=======
In code you could use:
Option Explicit
Private Sub UserForm_Initialize()
Me.ComboBox1.Style = fmStyleDropDownCombo
'or
Me.ComboBox1.Style = fmStyleDropDownList
End Sub
 
S

Susan

Hi, I wanted to rebump this question because I had a similar situation. I'm
sort of new to Excel VBA so please bear with me.

I have a combobox that lists client names.
I have it filled via RowSource to a named range (called "CLIENT_NAMES").
I want my users to be able to choose client names from the combobox,
however, if they have a new client, I want them to be able to just type in
the new client's name and have that added to my named range.

Aside from convoluted coding to read the value of the combobox, and then
using if/then statements to add it to my range, is there a more direct,
built-in method that I can do this? Or will I have to do a lot of coding
just to add this feature?

(If so I will just give my users a textbox instead and do my adding on the
excel side rather than the VBA side.)

Thanks in advance!
Susan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top