ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   find last row and copy previous row data (https://www.excelbanter.com/excel-worksheet-functions/177089-find-last-row-copy-previous-row-data.html)

Woodi2

find last row and copy previous row data
 
Could anyone help please. I am looking to create a macro that will find the
last rows data, copy that data then paste it in the row below.
i.e. row 10 is the last row containing data. I want a macro to copy the
data in row 10 and paste it in row 11.
I cant specify the row in the macro as the row numbers will increase each
time the macro is used.
Thanks in advance for any help.

Chip Pearson

find last row and copy previous row data
 
Try something like the following code. Change the value of the TEST_COLUMN
constant to the column letter that will be used to determine the last row.

Sub RepeatLastRow()
Const TEST_COLUMN = "C"
With ActiveSheet
.Cells(.Rows.Count,
TEST_COLUMN).End(xlUp).EntireRow.Resize(2).FillDow n
End With
End Sub


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"Woodi2" wrote in message
...
Could anyone help please. I am looking to create a macro that will find
the
last rows data, copy that data then paste it in the row below.
i.e. row 10 is the last row containing data. I want a macro to copy the
data in row 10 and paste it in row 11.
I cant specify the row in the macro as the row numbers will increase each
time the macro is used.
Thanks in advance for any help.




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

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