View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach[_2_] Otto Moehrbach[_2_] is offline
external usenet poster
 
Posts: 1,071
Default Hide row automatically based on date


Perhaps something like this. I assumed your data in Column C starts in C2
down. HTH Otto

Sub HideRows()
Dim rColC As Range
Dim i As Range
Set rColC = Range("C2", Range("C" & Rows.Count).End(xlUp))
For Each i In rColC
If DateSerial(Year(Date) - 4, Month(Date), Day(Date)) i.Value Then
i.EntireRow.Hidden = True
End If
Next i
End Sub
"Munchkin" wrote in message
...
I want my spreadsheet to look the date in colum C of each row. If the date
is more than 4 years old I'd like the row to be hidden. Any way to do
this
automatically?