View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default .AddItem list and populating combobox with created list

Do you have a combobox on that userform named cboDirect? It looked that way
from your code--but I could have guessed wrong.

If a combobox on a userform has a style of fmStyleDropDownList, then the user
can only choose from the items on the list. They can type in a value, but it
has to match an existing entry in that list.

If the combobox on a userform has a style of fmStyleDropDownCombo, then the user
can type any value--on the list or not on the list.

I don't see anything in your code (or mine!) that would cause errors.

pallaver wrote:

Hi Dave,

I entered in your code and I get the same problem: Excel highlights
".cboDirect" and I get the following "Computer Error: Method and data
member still not found." (at least that's what the translation means,
I'm working on a computer in Japan making troubleshooting excel/vba
even harder than it has to be).

To give a brief overview of what is going on, I'm trying to modify a
macro which is already built to add in a drop down combobox allowing
the using to either type in the number or select it from the drop down
menu. I've read though that the combobox allows for entry of only
inputs NOT already in the drop down list, hence my tangent above for a
text box.

That being said though, I still first need to figure out why I'm
getting an error every time I try and create a list. Any clues as to
what's going on?

Since, Neil

I'm not sure how RowWorkMin gets declared and changed, but this worked ok for
me:

Option Explicit
Private Sub UserForm_Initialize()
Dim i As Long
Dim RowWorkMin As Long

RowWorkMin = 77

With Me.cboDirect
.RowSource = ""
.Style = fmStyleDropDownList
.MatchEntry = fmMatchEntryComplete
For i = RowWorkMin To 88
Me.cboDirect.AddItem i
Next i
End With

End Sub

If you want to allow the user to type an entry that isn't on the dropdown list,
you can change the .style to fmStyleDropDownCombo. (I'm kind of confused about
what you wanted.)


--

Dave Peterson