This code has been working great. Then it just stopped working. If I remove a row it works once and then fails again after that point:
The 1004 Error occurs on this line below in the code when "the threshold" is reached whatever is causing it:
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Here's the Excel VBA Macro:
Sub InsertNewRow()
'
' InsertNewRow Macro
' Inserts a new row at row 2 and adds the date/time and user name.
'
' Keyboard Shortcut: Ctrl+Shift+N
'
ActiveSheet.Rows("2:2").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveSheet.Range("H2").Select
ActiveCell.FormulaR1C1 = Now()
ActiveSheet.Range("J2").Select
ActiveCell.FormulaR1C1 = UCase(Application.UserName & "")
ActiveSheet.Range("A2").Select
End Sub
Any idea on WHY this is happening and how it can be prevented permanently?
MORE INFORMATION:
The data is in a table in the sheet. If I simply select a row and then attempt to manually insert a row, the INSERT option is greyed out.
If I select a table row in its entirety and then attempt to insert a table row, the option to add rows to the table is also greyed out. It seems to be a limitation of Excel formatted tables. I'm not sure why it cannot handle below 6000 rows though. It seems buggy.
I tried this to see if it was a limit of the table itself:
...Received this error: