Populate combobox with visable rows only

M

max

I have a combobox where the rowsource property refers to a range on a worksheet

i.e. Sheet1!A:

However, I am using Autofilter to reduce this list. I would like only the visable rows on
Sheet1 to populate the rowsource property but it currently includes the hidden ones

Any ideas

Max
 
T

Tom Ogilvy

You would have to remove the rowsource property and load the box with code
using additem. An alternative would be to copy the filtered data to another
location and point the rowsource at that.

there really is no reason to point the whole column. In the initialize
event

Private Sub Userform_Initialize()
With Worksheets("Sheet1")
set rng = .Range(.Cells(1,1),.Cells(1,1).End(xldown))
End With
ComboBox1.RowSource = rng.Address(external:=True)
End sub
 
Top