Hi there,
Would appreciate a solution on the following:
I have a form with two list boxes, the 2nd being populated with the result of a selection in the 1st listbox. A selection in the 1st triggers an autofilter to find the
items for the 2nd listbox.
Problem is that when the autofilter shows only 1 row following the header row, the row details are not shown in the 2nd listbox. When 2 or more rows are filtered there is not problem in populating the 2nd listbox .Part of the code is shown below:
'
----------------------------------
' Autofilter on the selected record
'----------------------------------
With wsTemp
' AutoFilter on the selected value
.Activate
' Turn AutoFilter OFF
.AutoFilterMode = False
' Turn AutoFilter ON
.Range("F:F").AutoFilter Field:=1, Criteria1:=CStr(Me.lboRecSrch1.List(Me.lboRecSrch1.ListIndex))
' The autofiltered range
Set rRnge = .AutoFilter.Range
' The autofiltered range excluding header
Set rRnge = .AutoFilter.Range.Offset(1, 0).Resize(rRnge.Rows.Count - 1) _
.SpecialCells(xlCellTypeVisible)
End With
'--------------------------------------
' Build 2-dim array of associated items
'--------------------------------------
' Exit in case the user moves beyond the top of the listbox
On Error GoTo CLNxit
For Each rCell In rRnge.SpecialCells(xlCellTypeVisible)
'Debug.Print rRnge.SpecialCells(xlCellTypeVisible).Address
'Debug.Print rCell
ReDim Preserve vArrLst(4, lNdx)
' The Item#
vArrLst(0, lNdx) = rCell.Offset(0, -1)
Anything wrong with ranging the autofilter ?
Thanks - Eric
Bookmarks