Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Macro to Insert and copy entire row

I'm trying to create a macro that goes to the last row of data, goes to the
next row and then inserts a row. I then need it to copy & paste from the row
above it (formulas & formats only). Here is what I have so far, but its not
working.

range("A7").Select
Selection.End(xlDown).Select , Offset(1, 0)
Selection.EntireRow.Insert

range("NewPartDescr").Offset(-2, 0).EntireRow.Copy
range("NewPartDescr").Offset(-1, 1).EntireRow.Select

Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Application.CutCopyMode = False

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Macro to Insert and copy entire row

Two issues:
1) a row wasn't inserted
2) values were copied as well

"Don Guillett" wrote:

Without selections.

Sub copylastrowdown()
lr = Cells(Rows.Count, "a").End(xlUp).row
Rows(lr).Copy
Rows(lr + 1).PasteSpecial Paste:=xlPasteFormats
Rows(lr + 1).PasteSpecial Paste:=xlPasteFormulas
'cells(lr + 1,"a").select 'uncomment to select
End Sub

--
Don Guillett
SalesAid Software

"CCrew2000" wrote in message
...
I'm trying to create a macro that goes to the last row of data, goes to
the
next row and then inserts a row. I then need it to copy & paste from the
row
above it (formulas & formats only). Here is what I have so far, but its
not
working.

range("A7").Select
Selection.End(xlDown).Select , Offset(1, 0)
Selection.EntireRow.Insert

range("NewPartDescr").Offset(-2, 0).EntireRow.Copy
range("NewPartDescr").Offset(-1, 1).EntireRow.Select

Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Application.CutCopyMode = False



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 to copy previous row and insert two blank rows dd Excel Discussion (Misc queries) 1 April 30th 07 11:25 PM
excel macro-copy formula to entire column? kfboudreau Excel Discussion (Misc queries) 2 February 9th 07 08:21 PM
Macro: Insert, copy and past data from sheet Metaldream7 Excel Discussion (Misc queries) 0 November 8th 06 09:31 PM
Macro that will Cut rows and then insert-copy or append rod Excel Discussion (Misc queries) 3 October 21st 06 04:50 PM
Copy and insert cell info macro help JackR Excel Discussion (Misc queries) 2 March 21st 06 03:22 PM


All times are GMT +1. The time now is 12:19 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"