Combo Box addItem question

  • Thread starter Thread starter strataguru
  • Start date Start date
S

strataguru

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!
 
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
 
Back
Top