Hi,
i am trying to figure out why the following code doesnt show only filtered data on the listbox. Can someone help me please?
Dim rData As Range
With Blad1
Set rData = .Range(.Cells(1, 1), .Cells(.Rows.Count, 5).End(xlUp))
If Not .AutoFilterMode Then .Cells(1, 1).AutoFilter
.Cells(1, 1).AutoFilter field:=5, Criteria1:=txtuser.Text
On Error Resume Next
Set rSource = .AutoFilter.Range.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
.Cells(1, 200).CurrentRegion.ClearContents
rSource.Copy .Cells(1, 200)
Set rSource = .Cells(1, 200).CurrentRegion
Set rSource = rSource.Offset(1, 0).Resize(rSource.Rows.Count - 1, rSource.Columns.Count)
With frmmain.ListBox1
.RowSource = ""
.RowSource = rSource.Address(external:=True)
End With
End With
Unload Me
End If
Thanks,
Gokhan Kisacik
i am trying to figure out why the following code doesnt show only filtered data on the listbox. Can someone help me please?
Dim rData As Range
With Blad1
Set rData = .Range(.Cells(1, 1), .Cells(.Rows.Count, 5).End(xlUp))
If Not .AutoFilterMode Then .Cells(1, 1).AutoFilter
.Cells(1, 1).AutoFilter field:=5, Criteria1:=txtuser.Text
On Error Resume Next
Set rSource = .AutoFilter.Range.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
.Cells(1, 200).CurrentRegion.ClearContents
rSource.Copy .Cells(1, 200)
Set rSource = .Cells(1, 200).CurrentRegion
Set rSource = rSource.Offset(1, 0).Resize(rSource.Rows.Count - 1, rSource.Columns.Count)
With frmmain.ListBox1
.RowSource = ""
.RowSource = rSource.Address(external:=True)
End With
End With
Unload Me
End If
Thanks,
Gokhan Kisacik