View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Filtered list for Combo Box ListFillRange - Nested Combo Boxes

You can do the latter (range3) or you can not use the listfillrange
property and just use additem to fill the combobox2 list.

Some pseudo code:

Private Sub Combobox1_Click()
Dim cell as Range
Combobox2.Clear
Combobox2.ListCount = 2
for each cell in Range("Range2").Columns(1).Cells
if cell.Value = Combobox1.Value then
Combobox2.AddItem cell.Value
Combobox2.List(Combobox2.Listcount-1,1) = cell.offset(0,1)
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"DoctorG" wrote in message
...
ComboBox1 ListFillRange is Range1 and linked cell is Combo1Code
ComboBox2 ListFillRange is [Range2] where [Range2] must be a subset of the
whole Range2, where FieldA is equal to Combo1Code

Is there a way to filter this Range2 on the fly (in memory) and therefore
code it in the ListFillRange property ComboBox2 or should I physically

create
the filtered new range as Range3 in the worksheet in the ComboBox1_Change
event and use Range3 in ComboBox2's ListFillRange property?

Tx in advance