How to insert entirerow in table with no databodyrange

Tackwise

New Member
Joined
Aug 5, 2013
Messages
8
Hello,

I have a listobject (MyTable) situated above a larger dataset (= more columns) on a worksheet. This MyTable gets cleared and its databodyrange removed by either a macro or a manual delete.
Normally in order to reset the databodyrange I would write:
Code:
MyTable.ListRows.add (1)
However because there is a larger dataset below this table, VBA will return an error as it is unable to insert and shift the cells of the table downward without corrupting the larger dataset.
When deleting rows the same error will occure, however I can circumvent the error by deleting the entire row:
Code:
MyTable.DataBodyRange.Rows(n).EntireRow.Delete

My problem is that when there is no databodyrange, I am unable to select the EntireRow!
In order to circumvent the databodyrange I have tried the following:
Code:
MySheet.Rows(MyTable.HeaderRowRange.Row + 1).EntireRow.Resize(1).Insert

This does get me back a databodyrange, however instead of 1 single row, I now have 2 whereby one row has lost its formulas.

Is there a way to achieve the same as MyTable.ListRows.add (1) but then with an entire row and without losing formating and formulas?

Any help is greatly appreciated,

with kind regards Tackwise
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,215,324
Messages
6,124,250
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top