View Single Post
  #4   Report Post  
Arun
 
Posts: n/a
Default

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