Table resize problem

Jack_881

New Member
Joined
Sep 11, 2020
Messages
11
Office Version
  1. 2019
Platform
  1. Windows
Hi Experts

I have some code as follows:


With tblDest
On Error Resume Next
.DataBodyRange.Delete
.Resize .Range.Resize(tblSource.ListRows.Count + 1, .ListColumns.Count)
On Error GoTo 0
End With

The number of data rows in tblSource = 3 so I would expect when I resize tblDest I would expect the number of rows in that table to be 4 but it is only resizing to 1. I have checked the values by using

MsgbBox tblSource.ListRows.Count + 1 (this gives 4)
MsgbBox tblDest.ListRows.Count (this gives 1)

I use the code .DataBodyRange.Delete as I want to retain the formulas and formatting in tblDest. I assume the issue is around using the .DataBodyRange.Delete but cannot work out how to get around it.

Any help is greatly appreciated.

Jack
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,519
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Can you elaborate on what exactly you want your code to accomplish? Assuming the formulas you want to retain are in the databodyrange of tblDest, why are you deleting the databodyrange? Can you provide some more code/details so we can see how tblDest and tblSource are dimensioned and set? Are the two tables both on the active sheet?
 

Forum statistics

Threads
1,141,403
Messages
5,706,252
Members
421,434
Latest member
DaltonB

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
Top