Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
flow23
 
Posts: n/a
Default delete entirerow if date more than 12months old

I want to delete the entire row if the date in column B (yyyymm format e.g.
200605 for may 2006) is more than 12 months old.

how do I write the if statement in the macro?

  #2   Report Post  
Posted to microsoft.public.excel.misc
JB
 
Posts: n/a
Default delete entirerow if date more than 12months old

http://cjoint.com/?fzqFMePa5S

Sub test()
coldep = 2
For i = 2 To Cells(65000, coldep).End(xlUp).Row
If Cells(i, coldep) < DateSerial(Year(Date), Month(Date) - 12,
Day(Date)) Then
Rows(i).Hidden = True ' replace Hidden by delete
End If
Next i
End Sub


Cordialy JB

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
I WANT TO DELETE A WIDE OF DATE IN A EXCEL FILE Wing Excel Discussion (Misc queries) 1 November 25th 05 02:38 AM
Another Date issue. TimM Excel Worksheet Functions 1 November 17th 05 01:58 AM
Date Math Problem Dkline Excel Worksheet Functions 4 March 4th 05 04:11 PM
date and time ladimples247 New Users to Excel 2 February 16th 05 08:52 PM
Using formulas to determine date in one cell based on date in anot Gary Excel Worksheet Functions 2 November 22nd 04 08:11 AM


All times are GMT +1. The time now is 02:32 AM.

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"