Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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 |
#3
|
|||
|
|||
Thanks for your help
I will try another way Thanks Greg |
#4
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problems copying street addresses and dates | Excel Discussion (Misc queries) | |||
Any way toturn off the "Auto Fill Options" pop-up after copying ce | Excel Discussion (Misc queries) | |||
excel links update not working in auto, calculations in auto | Excel Worksheet Functions | |||
copying text into a macro | Excel Worksheet Functions | |||
Why can't my macro use Auto Filter when I told the Sheet Protecti. | Excel Worksheet Functions |