I have a table that I'm filling out, a budget for a project, and rather than have to right click and click and click to insert a row, I added a button and VBA to add a table row, and another button to delete a table row.
Sitting to the right of this table is a Pivot Table which summarizes the costs.
When the active cell is in a row next to the pivot table, I cannot add a row. But if I'm below the pivot table, I can. So if the last row of the pivot table is row 12, I have to be in row 13 or greater to use the button.
Here's the code for add and delete. Pretty simple stuff of course:
Is there a way to insert a row in a table next to a pivot table, independent of where I might be at the time? That's the key of course, I might decide to insert or delete a row anywhere.
Thank you!
Thanks!!
Matt
Sitting to the right of this table is a Pivot Table which summarizes the costs.
When the active cell is in a row next to the pivot table, I cannot add a row. But if I'm below the pivot table, I can. So if the last row of the pivot table is row 12, I have to be in row 13 or greater to use the button.
Here's the code for add and delete. Pretty simple stuff of course:
Code:
Sub InsertTableRow()
Rows(ActiveCell.Row).Insert
End Sub
Sub DeleteTableRow()
Rows(ActiveCell.Row).EntireRow.Delete
End Sub
Is there a way to insert a row in a table next to a pivot table, independent of where I might be at the time? That's the key of course, I might decide to insert or delete a row anywhere.
Thank you!
Thanks!!
Matt