Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populate Combo Box With Filtered List
Thank you Tom !
This works fine to add the filtered items to the a single column combo box. But I need to fill the cbo with 3 columns (ID, foreign ID, value). The ID (first column) will be used to filter the next cbo, but I need to display a "human understandable" value in the cbo. I thought about using "cbo.list" ... but I'm stuck. More help for me ?? Kinne Dim rng As Range For Each rng In Worksheets(WorksheetFiltered).Range(RangeFiltered) .Rows If rng.EntireRow.Hidden = False Then ' magic code here End If Next rng << Kinne |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populate Combo Box With Filtered List
Private Sub UserForm_Initialize()
Dim rng As Range cbo2.RowSource = "" cbo2.Clear cbo2.ColumnCount = 3 For Each rng In Range("Database").Rows If rng.EntireRow.Hidden = False Then cbo2.AddItem rng.Cells(1, 1).Value cbo2.List(cbo2.ListCount - 1, 1) = rng.Cells(1, 2) cbo2.List(cbo2.ListCount - 1, 2) = rng.Cells(1, 3) End If Next rng End Sub as an example. -- Regards, Tom Ogilvy "Kinne" wrote in message om... Thank you Tom ! This works fine to add the filtered items to the a single column combo box. But I need to fill the cbo with 3 columns (ID, foreign ID, value). The ID (first column) will be used to filter the next cbo, but I need to display a "human understandable" value in the cbo. I thought about using "cbo.list" ... but I'm stuck. More help for me ?? Kinne Dim rng As Range For Each rng In Worksheets(WorksheetFiltered).Range(RangeFiltered) .Rows If rng.EntireRow.Hidden = False Then ' magic code here End If Next rng << Kinne |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populate Combo Box With Filtered List
Tom,
Yes, that's it, thank you very much Tom ! Kinne Private Sub UserForm_Initialize() Dim rng As Range cbo2.RowSource = "" cbo2.Clear cbo2.ColumnCount = 3 For Each rng In Range("Database").Rows If rng.EntireRow.Hidden = False Then cbo2.AddItem rng.Cells(1, 1).Value cbo2.List(cbo2.ListCount - 1, 1) = rng.Cells(1, 2) cbo2.List(cbo2.ListCount - 1, 2) = rng.Cells(1, 3) End If Next rng End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selecting list to populate combo box | Excel Discussion (Misc queries) | |||
populate combo box | Excel Discussion (Misc queries) | |||
Populate a combo box | Excel Discussion (Misc queries) | |||
Populate List / Combo Box | Excel Discussion (Misc queries) | |||
Populate a combo Box | Excel Worksheet Functions |