View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Script to make my life easier??

Try this one with the dates in Column A

Sub Delete_with_Autofilter()
Dim DeleteValue As String
Dim rng As Range

DeleteValue = "<4/1/2003"

With ActiveSheet
.Columns("A").AutoFilter Field:=1, Criteria1:=DeleteValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete

End With
.AutoFilterMode = False
End With
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl


"dvshooter " wrote in message ...
Hello from a new forum user. Can anybody help? I would like to automate
the process of deleting a series of lines from a spredsheet. The lines
that need to be delted, have a field entiltled "Date of Leaving", and I
need to remove any rows where the date in this column occurs before 1st
April 2003. Any help would be greatly appreciated. Thanks guys


---
Message posted from http://www.ExcelForum.com/