View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_884_] Simon Lloyd[_884_] is offline
external usenet poster
 
Posts: 1
Default Deleting rows when a certain cell has a certain value


Hi paste this code in to the worksheet module, every time the sheet i
activated it will search through the specified range and delet
everything older than today!

Hope it helps.

Regards,
Simon

Option Explicit

Private Sub Worksheet_Activate()
Dim mycell
Dim rng As Range
Set rng = Range("A1:A100")
For Each mycell In rng
If mycell.Value < Date Then
Application.ScreenUpdating = False
mycell.EntireRow.Delete
End If
Next
Application.ScreenUpdating = True
End Su

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=57252