The following code was posted by AJ on 5/3, to insert a new row at the bottom of a table, including all of the formula etc.
Sub test()
Lastrow = Range("A65536").End(xlUp).Row
Rows(Lastrow & ":" & Lastrow).Select
Selection.Copy
Rows(Lastrow + 1 & ":" & Lastrow + 1).Select
ActiveSheet.Paste
End Sub
And it does what it was intended to do. However, I would like to amend the code to actually insert a new row and copy the formula and formatting down into the new row. A new row has to be inserted to maintain a gap with data that is held below the table. The above code seems to just transfer the formula and formatting to the next row down rather than insert an actual new row.
I think the additional code I need is something like:
Insert Row Shift:=xlShiftDown
but I don't know if thats right and, where do I put it?
Any help gratefully received.
Nobby
Sub test()
Lastrow = Range("A65536").End(xlUp).Row
Rows(Lastrow & ":" & Lastrow).Select
Selection.Copy
Rows(Lastrow + 1 & ":" & Lastrow + 1).Select
ActiveSheet.Paste
End Sub
And it does what it was intended to do. However, I would like to amend the code to actually insert a new row and copy the formula and formatting down into the new row. A new row has to be inserted to maintain a gap with data that is held below the table. The above code seems to just transfer the formula and formatting to the next row down rather than insert an actual new row.
I think the additional code I need is something like:
Insert Row Shift:=xlShiftDown
but I don't know if thats right and, where do I put it?
Any help gratefully received.
Nobby