ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to "archive" cells (https://www.excelbanter.com/excel-programming/366084-macro-archive-cells.html)

m3s3lf[_9_]

Macro to "archive" cells
 

I have data in columns A through H, with dates in column G. I want to
move all the data from A through H, for a given row, if the date in G
(on that row) is before today. I know how to make it check the date
against todays date, and I know how to paste the cells on the new page,
but I don't know how to reference the cells that I want moved in that
given row, so I can actually move them. I hope that makes sense.
Can anybody lend any advice?
Thanks you!


--
m3s3lf
------------------------------------------------------------------------
m3s3lf's Profile: http://www.excelforum.com/member.php...o&userid=34874
View this thread: http://www.excelforum.com/showthread...hreadid=557713


RB Smissaert

Macro to "archive" cells
 
Sub test()

Dim i As Long
Dim n As Long

For i = 1 To 10
If Cells(i, 7) < Date Then
n = n + 1
Range(Cells(i, 1), Cells(i, 8)).Copy Sheets(2).Cells(n, 1)
End If
Next

End Sub


RBS

"m3s3lf" wrote in
message ...

I have data in columns A through H, with dates in column G. I want to
move all the data from A through H, for a given row, if the date in G
(on that row) is before today. I know how to make it check the date
against todays date, and I know how to paste the cells on the new page,
but I don't know how to reference the cells that I want moved in that
given row, so I can actually move them. I hope that makes sense.
Can anybody lend any advice?
Thanks you!


--
m3s3lf
------------------------------------------------------------------------
m3s3lf's Profile:
http://www.excelforum.com/member.php...o&userid=34874
View this thread: http://www.excelforum.com/showthread...hreadid=557713




All times are GMT +1. The time now is 04:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com