I have written this code but if there is a value in one of the cells above the line I insert ... then it copies this value as well I am trying to use paste spiecial formulas .... but is still copying the value as well
Sub Insert_Rows()
'
' Macro8 Macro
' Macro recorded 04/08/2003 by Stephen Hoadley
'
'
Selection.EntireRow.Insert
ActiveCell.Offset(-1, 0).Rows("1:1").EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveCell.Offset(-1, 0).Range("A1").Select
Application.CutCopyMode = False
End Sub
Select any cell in row 4 and run the macro and you will se what I mean
Book1 |
---|
|
---|
| A | B | C | D |
---|
1 | | 1 | | |
---|
2 | | 2 | | |
---|
3 | | 3 | Steve | |
---|
4 | | 4 | | |
---|
5 | | 5 | | |
---|
6 | | 6 | | |
---|
|
---|