User Form

D

Derek Hart

OK, a newbie at UserForms in Excel. I want to make 2 combo boxes in Excel.
One has a named range which uses the data from the worksheet, which I
figured out, but when an item is chosen in the first combo, I want it to
requery and have a new list of items. What do I do to make this happen.

If Column 1 has Value1, Value2 in the data, then the 1st combo fills with
Value1 and Value2. Also, Column1 in the worksheet looks like this:
Column1
Value1
Value2

Then I have in Columns 2 and 3 the following, which I think I have to do to
represent what data to use for the 2nd combo.
Column2 Column3
Value1 A
Value1 B
Value1 C
Value2 AA
Value2 BB
Value2 CC

So how do I choose Value1 in the first combo (which reads from Column1), and
then have it show A,B,C in the 2nd combo?
 
F

FSt1

hi
this is called cascading combos where the second combo displays data based
on what is selected in the first combo.
example code
Private Sub ComboBox1_Change()
If Me.ComboBox1.Value = "1" Then
Me.ComboBox2.RowSource = "B5:B6"
Else
Me.ComboBox2.RowSource = "D5:D6"
End If

regards
FSt1
 
D

Derek Hart

Gets me on the right track, but from the data I showed below, I want to
choose an item in the first combo, Value1 or Value2, and use that to filter
the data in the second combo, in which the 1st column has Value1 and/or
Value2, and the 2nd column has the items. How can I do this?
 
F

FSt1

hi
is this static data or are you adding to it? if you are adding to it you
will have a lot of recodeing to do.
but i think you are setting this up a tad wrong. I would move the value1
data to column 4. or you could set the row source as is rowsource for value1
= column3 rows 1,2 and 3 (or C1:C3?) and set row source for value2 as column3
row 4,5 and 6 (or C4:C5 - assuming column 3 is column C)
your call.
Regards
FSt1
 
D

Derek Hart

If I have this data:

Form Name 1 a
Form Name 1 b
Form Name 1 c
Form Name 2 aa
Form Name 2 bb
Form Name 2 cc


I want to add it to a combo box on the UserForm, but only add the unique
values. This data is in a static named range. How could I do this?
 
F

FSt1

hi
row source will accept named ranges but it can't filter the range. you need
to put your unique values in a seperate named range as i suggested in my last
post.

Regards
FSt1
 

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