ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add Row after last entry (https://www.excelbanter.com/excel-programming/409909-add-row-after-last-entry.html)

Danielle0904

Add Row after last entry
 
I am working in a workbook that has 5 sheets. Each sheet has different data
and calculations based on information in the first sheet.

What I want to do is
1. Find the last row on the first worksheet that has data in it. Copy that
row, and add a new row right below it with the copied information.

2. Go to the next worksheet and do the same thing.

3. Continue that process until all worksheets have a new row added to the
bottom.

Don Guillett

Add Row after last entry
 
Is this what you want?

sub copylastrowoneachsheetdownone()
for each ws in worksheets
with ws
lr=.cells(rows.count,"a").end(xlup).row
.rows(lr).copy .rows(lr+1)
end with
next ws


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Danielle0904" wrote in message
...
I am working in a workbook that has 5 sheets. Each sheet has different
data
and calculations based on information in the first sheet.

What I want to do is
1. Find the last row on the first worksheet that has data in it. Copy
that
row, and add a new row right below it with the copied information.

2. Go to the next worksheet and do the same thing.

3. Continue that process until all worksheets have a new row added to the
bottom.



Danielle0904

Add Row after last entry
 
Hi Don,
That worked for what I originally asked - but I forgot that there will be
times that the last row will have information - so the formulas will paste as
information and not blank.

How would you re-write the last line to copy the row and the paste special /
formulas?


"Don Guillett" wrote:

Is this what you want?

sub copylastrowoneachsheetdownone()
for each ws in worksheets
with ws
lr=.cells(rows.count,"a").end(xlup).row
.rows(lr).copy .rows(lr+1)
end with
next ws


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Danielle0904" wrote in message
...
I am working in a workbook that has 5 sheets. Each sheet has different
data
and calculations based on information in the first sheet.

What I want to do is
1. Find the last row on the first worksheet that has data in it. Copy
that
row, and add a new row right below it with the copied information.

2. Go to the next worksheet and do the same thing.

3. Continue that process until all worksheets have a new row added to the
bottom.





All times are GMT +1. The time now is 09:22 AM.

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