#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,345
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"