ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combo Box addItem question (https://www.excelbanter.com/excel-programming/281452-combo-box-additem-question.html)

strataguru[_9_]

Combo Box addItem question
 

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/


Tom Ogilvy

Combo Box addItem question
 
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/





All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com