Table resize problem

Jack_881

New Member
Joined
Sep 11, 2020
Messages
16
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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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?
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,541
Latest member
iparraguirre89

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