View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jarek Kujawa[_2_] Jarek Kujawa[_2_] is offline
external usenet poster
 
Posts: 896
Default A macro that will hide all but the last 20 dated rows.

in Excel 2003

Sub hide()
Dim counter As Integer

ActiveSheet.Range("A65536").Select
Selection.End(xlUp).Select
For i = 1 To Selection.Row
If Len(Selection) 0 And IsDate(Selection) Then
counter = counter + 1
If counter <= 2 Then
Selection.Rows.EntireRow.Hidden = True
Else
Exit For
End If
End If
Selection.Offset(-1, 0).Select
Next i
End Sub

for Excel 2007 adjust the "ActiveSheet.Range("A65536").Select" row
accordingly

HIH