Private Sub Userform_Initialize()
Dim sh as Worksheet
Dim cell as Range
set sh = Worksheet("sheet1")
for each cell in sh.range(sh.cells(2,5),sh.cells(rows.count,5).End( xlup))
if not isempty(cell) then
combobox1.AddItem cell
end if
Next
End sub
--
Regards,
Tom Ogilvy
"strataguru" wrote in message
...
Hi,
I am looking to populate a combox with values from a column in a
worksheet..... but not every row is populated. How do I filter out the
rows that have no values from being populated in the combo box?
Also - after my macro loads the userform - in the userform initialize
function I'd like to query a specific worksheet to pull in the values
explained above - but I'm getting an error that the object isn't
valid.
Any ideas?
Thanks!
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/