View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Hafeez Esmail Hafeez Esmail is offline
external usenet poster
 
Posts: 22
Default Navigating a filtered list

Hi Jim, thanks for replying!
I added my code to yours but it doesn't give me what I
want.

Dim Cell As Range
Dim Counter As Long
For Each Cell In Range("_FilterDatabase").Columns(1) _
.SpecialCells(xlCellTypeVisible)
..SpecialCells(xlCellTypeVisible)
Counter = Counter + 1
If Counter 2 Then
MsgBox Str(Counter), , "For Each"
Cell(Counter, 1).Select
dateA = ActiveCell.Value
dateB = ActiveCell.Offset(0, 1).Value
strDataD = ActiveCell.Offset(0, 3).Value
strDataN = ActiveCell.Offset(0, 13).Value
MsgBox "A/B = " & dateA & "/" & dateB
End If
Next
There are two things wrong.
1) it's going to every other cell
2) it's picking up data from every single cell (even ones
that are not visible)

Please help
Hafeez Esmail

-----Original Message-----
You can use the SpecialCells method to find the visible

rows in an
autofilter. Maybe you can build something based on this

example:


Sub a()
Dim Cell As Range
Dim Counter As Long
For Each Cell In Range("_FilterDatabase") _
.Columns(1).SpecialCells(xlCellTypeVisible)
Counter = Counter + 1
If Counter 2 Then MsgBox Cell.Address
Next
End Sub

Excel always assigns the "_FilterDatabase" range name to

a autofilter list.
The " 2" is to skip (1) the headings and (2) your blank

row.


--
Jim Rech
Excel MVP


.