Hi
If you try the following code I think that it should do what you require.
Sub insert_row()
Dim Msg, Style, Title, Response, MyString, currow As Integer, c As Range
Msg = "Is the cursor on the correct row ? A row will be inserted beneath." ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Row Insertion" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
ActiveCell.EntireRow.Insert
Let currow = ActiveCell.Row
For Each c In Rows(currow - 1).Cells
If c.HasFormula = True Then 'Checks for a formula
Cells(currow - 1, c.Column).Copy ' Copies formula if it exists
Cells(currow, c.Column).Select
Selection.PasteSpecial Paste:=xlFormulas
End If
Next
Else ' User chose No.
End
End If
End Sub
The code inserts a line below the cursor and copies formulas only to the new line from the line above.
Regards
Jeff
Bookmarks