find last row and copy previous row data

W

Woodi2

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.
 
C

Chip Pearson

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).FillDown
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top