View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Help required to select a cell in a filtered list

I'd just look for a row that's visible:

Option Explicit
Sub testme()

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim CurRow As Long

CurRow = ActiveCell.Row
With ActiveSheet.AutoFilter.Range
FirstRow = .Row
LastRow = .Rows(.Rows.Count).Row
End With

If CurRow = LastRow _
Or CurRow < FirstRow Then
MsgBox "not in the autofilter range--or out of room!"
Exit Sub
End If

Do
If ActiveCell.Row = LastRow Then
Exit Do 'at the bottom of the range
End If

ActiveCell.Offset(1, 0).Select

If ActiveCell.Row LastRow Then
MsgBox "Out of the autofilter range!"
Exit Do
End If

If ActiveCell.EntireRow.Hidden = True Then
'keep looking
Else
Exit Do
End If
Loop

End Sub

Jim wrote:

Windows XP and Excel 2003
I have filtered some rows of data and would like to move the active cell
sequentially down the list.
Equivalent to using the cursor down key ... Is this possible with vba

Regards & TIA


--

Dave Peterson