Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting list to populate combo box gramps Excel Discussion (Misc queries) 2 August 11th 07 06:37 PM
populate combo box enyaw Excel Discussion (Misc queries) 1 October 26th 06 03:13 PM
Populate a combo box damorrison Excel Discussion (Misc queries) 11 September 3rd 06 09:04 PM
Populate List / Combo Box Dave C Excel Discussion (Misc queries) 1 October 6th 05 08:15 PM
Populate a combo Box case54321 Excel Worksheet Functions 1 June 14th 05 02:53 PM


All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"