![]() |
Auto copying row
Hi all
I am wondering if there is a code that i can run automatically, I have to have my database no older than 2 years. What i would like is for a macro or something to search the entire a column find the dates older than 2 year and move then to another sheet. Thanks in advance Greg |
use a heading <ddate
today 25 feb 2005 i.e. 2/25/03 criteria ddate <2/25/2003 use advance filter and copy to some ohter location. see help advance filter. create a macro on this ================== Greg B... wrote in message ... Hi all I am wondering if there is a code that i can run automatically, I have to have my database no older than 2 years. What i would like is for a macro or something to search the entire a column find the dates older than 2 year and move then to another sheet. Thanks in advance Greg |
Thanks for your help
I will try another way Thanks Greg |
yeah u can do it. by something like this
dim mSrcRwCtr, mTrgRwCtr as integer mSrcRwCtr = 2 ' assuming you've field labels on row 1 mTrgRwCtr = 2 while Sheets("Sheet1").range("A" &mSrcRwCtr).value < "" ' assuming the date value is in col A if datediff("yyyy",Sheets("Sheet1").range("A" &mSrcRwCtr).value,today) then Sheets("Sheet1").range("A" &mSrcRwCtr).select.entirerow selection.cut sheets("Sheet2").range("A"&mTrgRwCtr).select ActiveSheet.Paste mTrgRwCtr = mTrgRwCtr + 1 endif mSrcRwCtr = mSrcRwCt + 1 wend This is not a verified code, pl. check and have backup before trying this :) "Greg B..." wrote: Hi all I am wondering if there is a code that i can run automatically, I have to have my database no older than 2 years. What i would like is for a macro or something to search the entire a column find the dates older than 2 year and move then to another sheet. Thanks in advance Greg |
All times are GMT +1. The time now is 10:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com