ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   another listbox question (https://www.excelbanter.com/excel-programming/322940-another-listbox-question.html)

[email protected]

another listbox question
 
hi all, following on from another question, is it possible to display
data that is filtered within a list box, i only want certain data to
appear in this list the list is automatically filtered, but the whole
list still appears in the list box.

regards john


Tom Ogilvy

another listbox question
 
Private Sub UserForm_Activate()
Dim rng As Range, rng1 As Range
Dim cell As Range
Dim i As Long
ListBox1.Clear
ListBox1.ColumnCount = 4
Set rng = Range("a2:a50")
On Error Resume Next
Set rng1 = rng.SpecialCells(xlVisible)
On Error GoTo 0
If Not rng1 Is Nothing Then
For Each cell In rng1
ListBox1.AddItem cell.Value
i = ListBox1.ListCount - 1
ListBox1.List(i, 1) = cell.Offset(0, 1)
ListBox1.List(i, 2) = cell.Offset(0, 2)
ListBox1.List(i, 3) = cell.Offset(0, 3)
Next
End If

End Sub

--
Regards,
Tom Ogilvy




wrote in message
oups.com...
hi all, following on from another question, is it possible to display
data that is filtered within a list box, i only want certain data to
appear in this list the list is automatically filtered, but the whole
list still appears in the list box.

regards john





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

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