View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Paul Paul is offline
external usenet poster
 
Posts: 49
Default Another Delete question

Jeremiah,

Looping is the way to go. BUT you work from the bottom of the list up.

For instance you have a nice list with a number of columns, starting in A1.

Sub DeleteRows()
Dim rng As Range
Dim lRows As Long
Dim lCounter As Long

Set rng = Range("A1").CurrentRegion
lRows = rng.Rows.Count

'Loop through list from the bottom.
For lCounter = lRows To 1 Step -1
If Cells(lCounter, 4).Value = "" Then
Cells(lCounter, 4).EntireRow.Delete
End If
Next
End Sub

Make sure your list has NO entirely blank rows within it to begin with.


Paul



"jeremiah" wrote in message
...
I need to group records by the value in column A (employees, who can have
multiple records) and then delete all of any employees who have no records
with a date in column D.

Have given this some thought and have tried filters, loops, offsets and
just
can't quite figure out the best way to do it. The groups of records will
be
variable each week.