View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT3686 JT3686 is offline
external usenet poster
 
Posts: 1
Default Data List Visible Rows

Hi,

I have a user form which acts as a DB front end for a spreadsheet and I
want it to skip any rows hidden by AutoFilter. I constructed the following
code based on chapter 9 in "Excel 2003 VBA Programmer's reference" . The code
loops through the next rows in the range and tests if they are hidden.
Unfortunately, it doesn't work as expected and seems to skip rows that aren't
hidden and show ones that are.

Private Sub cmdNextRecord_Click()
Dim i As Integer
i = 1
With Range("Database")
Do While RangeData.Rows(Navigator.Value + i).EntireRow.Hidden = True
i = i + 1
Loop
If RangeData.Row < .Rows(.Rows.Count).Row Then
'Load next record only if not on last record
Navigator.Value = Navigator.Value + i
End If
End With
End Sub

Regards
JT