PDA

View Full Version : Fill a combobox from a spreadsheet?



melgibson2
09-08-2010, 07:46 AM
Hi. It's been years since I did any VBA and need to relearn some basics.

I need to fill a combobox from a list on a spreadsheet. That isn't hard - either use .additem, or set the RowSource of the combobox to the column. The issue is that more entries may be added to the list at any time, and the combobox needs to auto-update itself when the userform is started.

RowSource could be set to something ridiculous like a1:1000, but this leaves a massive chunk of the combobox list as blank.

I used to have a simple way of doing it but I can't remember - I usually set a blank cell out of the way somewhere to counta(a:a) - this counts the number of entries in the list, then I set up an array that gets all the data up to the number in that counta cell.

Any ideas?

Tinbendr
09-08-2010, 04:07 PM
Welcome to VBA Express!

Like this. (http://www.vbaexpress.com/forum/showthread.php?t=26269)