Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filling 2 column list box with Collection?
Have a collection containing folders and files that I want to put into a 2
column list box using a For Loop. I have done this in Access vba and .Net apps, but I'm going crazy trying to get this to work in excel vba. Can any one show or point me to a code sample demonstrating this, Please? Found lots of samples of setting the list() property to an array, but nothing on doing it row by row with a loop. Thanks in advance for any help -- / Sean the Mc / "I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filling 2 column list box with Collection?
For Each Item In MyCollection
With UserForm1.ListBox1 .AddItem Item .list(.listcount - 1, 1) = "filename" End With Next Item You said a collection, but not sure where the pathes and the filenames are located unless you are parsing them out of the collection or you have arrays in the collection. In any event, how you address the listbox is illustrated - you should be able to adapt it to your data source. -- Regards, Tom Ogilvy "What-a-Tool" wrote in message news:M4W%c.17411$aW5.14719@fed1read07... Have a collection containing folders and files that I want to put into a 2 column list box using a For Loop. I have done this in Access vba and .Net apps, but I'm going crazy trying to get this to work in excel vba. Can any one show or point me to a code sample demonstrating this, Please? Found lots of samples of setting the list() property to an array, but nothing on doing it row by row with a loop. Thanks in advance for any help -- / Sean the Mc / "I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filling 2 column list box with Collection?
Thank you very much - was just the ~ .list(.listcount - 1, 1) = "filename"
~ That I wasn't seeing. Works great. -- / Sean the Mc / "I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931) "Tom Ogilvy" wrote in message ... For Each Item In MyCollection With UserForm1.ListBox1 .AddItem Item .list(.listcount - 1, 1) = "filename" End With Next Item You said a collection, but not sure where the pathes and the filenames are located unless you are parsing them out of the collection or you have arrays in the collection. In any event, how you address the listbox is illustrated - you should be able to adapt it to your data source. -- Regards, Tom Ogilvy "What-a-Tool" wrote in message news:M4W%c.17411$aW5.14719@fed1read07... Have a collection containing folders and files that I want to put into a 2 column list box using a For Loop. I have done this in Access vba and .Net apps, but I'm going crazy trying to get this to work in excel vba. Can any one show or point me to a code sample demonstrating this, Please? Found lots of samples of setting the list() property to an array, but nothing on doing it row by row with a loop. Thanks in advance for any help -- / Sean the Mc / "I have not failed. I've just found 10,000 ways that won't work." - Thomas Alva Edison (1847-1931) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
filling list | Excel Discussion (Misc queries) | |||
how to change column references, while filling down another column | Excel Discussion (Misc queries) | |||
Filling in a form from a list | Excel Discussion (Misc queries) | |||
Filling An Autofiltered List | Excel Programming | |||
filling a two column listbox from a two column recordset | Excel Programming |