PDA

View Full Version : Dynamicly Fill Listbox with column headers?



bubbapost
04-14-2010, 03:58 PM
Hello,

I am trying to fill a listbox on a userform with column headers, but I want it to be dynamic so that no matter how many column headers there are it won't be hard coded to a particular range.

Any help or suggestions would be greatly appreciated!

Andy

tpoynton
04-14-2010, 05:18 PM
Dim cell As Range
For Each cell In Range(Cells(1, 1), Cells(1, Columns.Count).End(xlToLeft))
ListBox.AddItem cell.Value
Next cell

bubbapost
04-14-2010, 08:54 PM
Thanks tpoynton,

That works perfectly!