ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate combobox with visable rows only (https://www.excelbanter.com/excel-programming/291558-populate-combobox-visable-rows-only.html)

max

Populate combobox with visable rows only
 
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

Tom Ogilvy

Populate combobox with visable rows only
 
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

--
Regards,
Tom Ogilvy


"max" wrote in message
...
I have a combobox where the rowsource property refers to a range on a

worksheet.

i.e. Sheet1!A: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





All times are GMT +1. The time now is 02:24 AM.

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