ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Last Row Help (https://www.excelbanter.com/excel-programming/300719-last-row-help.html)

Michael168[_89_]

Last Row Help
 
Can someone modify the macro below so that it will always copy the las
row and paste one row below when I run the macro.
The macro runs from sheet 1 - sheet 10

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 6/8/2004 by Michael
'

'
Sheets("Sheet 1").Select
Range("A240").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Range("A241").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("Sheet 2").Select
Range("A240").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Range("A241").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A242").Select

.............. until Sheet 10

End Sub

Thanks
Michae

--
Message posted from http://www.ExcelForum.com


JE McGimpsey

Last Row Help
 
One way:

Public Sub CopyToNextRow()
Dim i As Long
For i = 1 To 10
With Worksheets(i)
With .Range("A" & .Rows.Count).End(xlUp)
.EntireRow.Copy .Offset(1, 0)
End With
End With
Next i
End Sub

In article ,
Michael168 wrote:

Can someone modify the macro below so that it will always copy the last
row and paste one row below when I run the macro.
The macro runs from sheet 1 - sheet 10

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 6/8/2004 by Michael
'

'
Sheets("Sheet 1").Select
Range("A240").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Range("A241").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("Sheet 2").Select
Range("A240").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Range("A241").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A242").Select

............. until Sheet 10

End Sub



All times are GMT +1. The time now is 03:36 PM.

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