Entirerow.delete based on multiple cells
Dim dt as Date
Dim lastrow as Long
Dim i as Long
set dt = DateSerial(2005,12,1)
lastrow = cells(rows.count,"ab").end(xlup)
for i = lastrow to 2 step -1
if cells(i,"ab).Value < dt and _
cells(i,"ac").Value < dt and _
cells(i,"ad").Value < dt and _
cells(i,"ae").Value < dt then
rows(i).Delete
end if
Next
--
Regards,
Tom Ogilvy
"tom" wrote in message
ups.com...
I need to delete entire rows if the date of cells in rows ab, ac, ad
adn ar are before Dec 1, 2005.
I can do a delete based on the contents of a single cell easily enough,
but this throws me.
For example:
ab ac ad ae
------------------------------------------------
12/2/05 | 11/5/05 | 11/3/05 | 11/30/05
11/30/05 | 11/1/05 | 11/5/05 | 11/5/05
I would like the routine to delete the second row, since all dates are
before 12/1/05, but leave
the first row intact since at least one date is after 12/1/05. Of
course, the live spreadsheet includes more than just two rows.
Any help would be greatly appceciated.
Thanks
-tom
|