Combobox Population

  • Thread starter Thread starter Greg B
  • Start date Start date
G

Greg B

Hi All,

I need to fill a combobox with data I have on a sheet called stock. The part
numbers are in Column A. What I would like is populate with the correct
amount. I assume if I used the whole column the combobox fill would be huge.
 
Hi All,

I need to fill a combobox with data I have on a sheet called stock. The part
numbers are in Column A. What I would like is populate with the correct
amount. I assume if I used the whole column the combobox fill would be huge.
Hi Greg

Are you talking about a Userform Combobox or a Data Validation Dropdown
List?

Mick.
 
userform sorry forgot that part
Hmm, sorry! that be my achille's heel in that I haven't had the need to
do any Userform work thus have little knowledge in this area.

Cheers
Mick.
 
Greg B expressed precisely :
Hi All,

I need to fill a combobox with data I have on a sheet called stock. The part
numbers are in Column A. What I would like is populate with the correct
amount. I assume if I used the whole column the combobox fill would be huge.

Explain what you mean by "the combobox fill would be huge". Are there
duplicate part numbers or just lots of them? (I assume you don't want
blanks!)

Do you want to load the combobox with a specific number of items at a
time and provide controls for stepping through all items by moving in
next-in-line?

Do you want a sorted list?

Would a listbox possibly serve you better since users could simply
click an item as apposed to opening the list and navigating it to
select an item? (Note that a combobox will cycle through all entries
that begin with the first letter typed, and so may be the better tool
for the job at hand)

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
Assuming you know how to create a userform, this would be the code to populate it with items from Column A

'----------------------------------------
Private Sub CommandButton1_Click()

Range("C1") = ComboBox1
Unload Me

End Sub

Private Sub UserForm_Initialize()

Dim Rws As Long, Rng As Range

Rws = Cells(Rows.Count, "A").End(xlUp).Row

Set Rng = Range(Cells(2, 1), Cells(Rws, 1))

ComboBox1.List = Rng.Value

End Sub
'---------------------------------------------

Check this out to learn how to create a UserForm. Insert a combobox instead of a textbox in the example.
http://www.davesexcel.com/createauserform.htm
Here is an example
http://www.davesexcel.com/Populate A Combobox in a userform.xlsm
 
Back
Top