Hello,
I have the following code which has been working for years. The tab it runs on (using a button via insert shape) is debugging at ActiveSheet.Paste. Any suggestions? I have even rerecorded a macro following the same steps and can't seem to figure out why it is failing. I don't believe the clipboard is being cleared in the code for it to fail. Thanks in advance.
Sub InsertNewRowVar()
Dim CurrentRow As Integer
Application.ScreenUpdating = False
Ans = MsgBox("Is the Cursor at the position of the New Row?", vbYesNo + vbQuestion, "REMINDER!!!")
If Ans = vbNo Then Exit Sub
CurrentRow = ActiveCell.Row
If Range("A" & CurrentRow) = "X" Then
MsgBox ("Cannot insert New Rows in Header area!")
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Exit Sub
End If
Call Unprotect
Range("A" & CurrentRow).EntireRow.Insert
Range("A4:CN4").Copy
Range("A" & CurrentRow).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("B" & CurrentRow).FormulaR1C1 = _
"=R[-1]C"
Range("C" & CurrentRow).Select
Call Protect
End Sub
Bookmarks