View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Delete data if not within date range

assuming you mean farther away from today's date than 14 days and not 14
days exactly,

set lastrow = cells(rows.count,"C").End(xlup)
for lastrow to 2 step -1
if abs(Date-Int(cells(i,"C"))) 14 then
rows(i).Delete
end if
Next

adjust the "" to "=" if you want to delete dates exactly 14 days away

--
Regards,
Tom Ogilvy


"Denise" wrote in message
oups.com...
I have a cumbersome spread sheet that contains over 20,000 rows that
includes a date column. Using the current date as a reference point, I
would like to delete all rows 14 days prior to today and 14 days after
today. Any help would be appreciated.