ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListBoxes - RowSource (https://www.excelbanter.com/excel-programming/326772-listboxes-rowsource.html)

SA3214

ListBoxes - RowSource
 
I am trying to find a way to use a filtered range as the Rowsource for a
listbox
I hoped to use AutoFilter to provide the data but it doesn't seem
appropriate.
Will I have to copy the filtered data to another area on the worksheet ?
.... or is there a better way to achieve the desired result ?


Regards & TIA



Ron de Bruin

ListBoxes - RowSource
 
Hi

You can also fill your listboxes with code and loop through the visible cells in the range

For Each cell In Range("A1:A100").SpecialCells(xlCellTypeVisible)
'your code
Next



--
Regards Ron de Bruin
http://www.rondebruin.nl



"SA3214 @Eclipse.co.uk" <sa3214<No Spam wrote in message ...
I am trying to find a way to use a filtered range as the Rowsource for a listbox
I hoped to use AutoFilter to provide the data but it doesn't seem appropriate.
Will I have to copy the filtered data to another area on the worksheet ?
... or is there a better way to achieve the desired result ?


Regards & TIA




SA3214

ListBoxes - RowSource
 
Thanks for the pointer Ron
Not sure what to put in place of 'your code yet ... but I'll give it a try



"Ron de Bruin" wrote in message
...
Hi

You can also fill your listboxes with code and loop through the visible
cells in the range

For Each cell In Range("A1:A100").SpecialCells(xlCellTypeVisible)
'your code
Next



--
Regards Ron de Bruin
http://www.rondebruin.nl



"SA3214 @Eclipse.co.uk" <sa3214<No Spam wrote in message
...
I am trying to find a way to use a filtered range as the Rowsource for a
listbox
I hoped to use AutoFilter to provide the data but it doesn't seem
appropriate.
Will I have to copy the filtered data to another area on the worksheet ?
... or is there a better way to achieve the desired result ?


Regards & TIA






Ron de Bruin

ListBoxes - RowSource
 
Not sure what to put in place of 'your code yet ... but I'll give it a try

If you have a listbox on a userform you can use this event in the
userform module

Private Sub UserForm_Initialize()
Dim cell As Range
For Each cell In Range("A1:A100").SpecialCells(xlCellTypeVisible)
Me.ListBox1.AddItem cell.Value
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"SA3214 @Eclipse.co.uk" <sa3214<No Spam wrote in message ...
Thanks for the pointer Ron
Not sure what to put in place of 'your code yet ... but I'll give it a try



"Ron de Bruin" wrote in message ...
Hi

You can also fill your listboxes with code and loop through the visible cells in the range

For Each cell In Range("A1:A100").SpecialCells(xlCellTypeVisible)
'your code
Next



--
Regards Ron de Bruin
http://www.rondebruin.nl



"SA3214 @Eclipse.co.uk" <sa3214<No Spam wrote in message ...
I am trying to find a way to use a filtered range as the Rowsource for a listbox
I hoped to use AutoFilter to provide the data but it doesn't seem appropriate.
Will I have to copy the filtered data to another area on the worksheet ?
... or is there a better way to achieve the desired result ?


Regards & TIA









All times are GMT +1. The time now is 12:17 AM.

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