Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a spreadsheet where the leftmost column is dates in ascending order. I
want to write a macro that will hide all but the last 20 dated rows. Cany anybody help please. -- Mac Macdonald |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to hide rows not working | Excel Discussion (Misc queries) | |||
Auto-Hide Rows Macro | Excel Worksheet Functions | |||
Macro to hide rows | Excel Discussion (Misc queries) | |||
hide rows with macro | Excel Discussion (Misc queries) | |||
macro to hide rows | Excel Discussion (Misc queries) |