Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete data if not within date range

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to delete blank rows in a data range Youlan Excel Discussion (Misc queries) 5 September 17th 08 08:51 AM
delete row if no data, non-contiguous range problem rjamison Excel Programming 0 June 14th 05 12:14 AM
delete row if no data, non-contiguous range problem Nile Gilmanov Excel Programming 12 April 23rd 05 12:36 PM
Delete Date data macro KAnoe Excel Programming 3 November 6th 04 02:26 AM
Excel VBA - Delete rows within a date range rott Excel Programming 8 February 24th 04 07:38 PM


All times are GMT +1. The time now is 10:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"