ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Add Row Macro? (https://www.excelbanter.com/excel-discussion-misc-queries/164103-add-row-macro.html)

Matt

Add Row Macro?
 
Not too familiar with macros but I'm assuming there is a way to create
a macro that can find the last row containing data in a sheet and add
another row after the last item. The catch is that the added row
should carry the same formatting as the previous. Is this do-able?

Thanks,

Matt


Sandy Mann

Add Row Macro?
 
a macro that can find the last row containing data in a sheet and add
another row after the last item.


Is there mode data further down the sheet? If not then try:

Sub FormatIt()
Dim LastRow As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row

Rows(LastRow).Copy
Rows(LastRow + 1).PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
Cells(LastRow + 1, 1).Select
End Sub

This assumes that there is data in Column A.

If there is more data further down the sheet try:

Sub FormatIt()
Dim LastRow As Long
LastRow = Cells(5, 1).End(xlDown).Row
Cells(LastRow + 1, 1).EntireRow.Insert

Rows(LastRow).Copy
Rows(LastRow + 1).PasteSpecial Paste:=xlFormats
Application.CutCopyMode = False
Cells(LastRow + 1, 1).Select
End Sub

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Matt" wrote in message
ups.com...
Not too familiar with macros but I'm assuming there is a way to create
a macro that can find the last row containing data in a sheet and add
another row after the last item. The catch is that the added row
should carry the same formatting as the previous. Is this do-able?

Thanks,

Matt







All times are GMT +1. The time now is 07:06 PM.

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