View Full Version : Solved: Fill combox from given column
fadib
12-14-2007, 09:14 AM
Hi guys,
I have a list of food in sheet1, I want to enter all the values inside to combobox?
How can I do that if I have the combobox1 is in a sheet? in a userform?
I can input the data one by one, but it will take me forever. :dunno
Thanks...
figment
12-14-2007, 09:56 AM
something like this works
a = Range("B2:B9")
UserForm1.ComboBox1.List = a
fadib
12-14-2007, 12:09 PM
I tried that, didn't work.
In sheet1 I have from B2 to B219 a set of values.
In sheet2, I have a combobox made.
I am trying to fill the combobox with the data from sheet1.
Also anyone know how to show in the combobox "-Please select-" as soon as the sheet is activated.
This will provide some guidance to the user.
Bob Phillips
12-14-2007, 12:19 PM
Just link it.
Right-click the combo, select Format control, choose the Control tab, and then use the Input range RefEdit to navigate to the target range.
fadib
12-14-2007, 07:27 PM
Private Sub combobox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim RowNum As Variant
With Worksheets("Sheet2")
RowNum = Application.Match(ComboBox1.Value, .Columns(1), 0)
TextBox1.Text = .Cells(RowNum, "C").Value
End With
End Sub
Private Sub UserForm_Activate()
a = Sheet2.Range("A5:A219")
UserForm1.ComboBox1.List = a
End Sub
This is what I have so far in my userform.
now what happens is, after I select from the combobox, Textbox1 is suppose to show the corresponding value instanteneously.
is there anyway to accomplish that?
Bob Phillips
12-15-2007, 03:02 AM
Userform? You said it was on Sheet2 previously!
Private Sub ComboBox1_Change()
me.TextBox1.Text = me.ComboBox1.value
End Sub
fadib
12-15-2007, 03:10 PM
you are totaly right, I said sheet.
I am trying to learn both of them.
I still don't know how to do the sheet one.
When I make a combobox in the sheet, what should I do next. You have mentioned to me refefit, I can't find it:(
Bob Phillips
12-15-2007, 04:55 PM
I gave a full set of instructions.
fadib
12-15-2007, 06:50 PM
:doh: Now I got it. I have to play with properties of the combobox.
Thanks XLD.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.