Problem With Table References

KAELondon

New Member
Joined
Apr 4, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hello all,

I have this button I made on one of my sheets in order to add rows to tables as more entries ar required. As all tables work in reference to the first one everything works fine but for one thing: On the first table one of the columns references the corresponding rows in a subsequent table but (I'm guessing because in the order of operations said table is created after the new row is added in the first one) this causes the formula to not copy properly, resulting either in a SPILL error if it's referencing the table column or the cell reference becoming the new cell below the second table if using a range. Is there an easy fix for this that anyone has?

Here is the module for the button:

'"ADD ENTRY" button on "OVERVIEW" tab which adds an entry to the list on the "OVERVIEW" tab, "DETAILS" tab, "SUMMARY" tab & "REPORT" tab
Sub Add_Entry()

'"OVERVIEW" tab row add
ActiveSheet.Unprotect Password:="XXX"
ActiveSheet.ListObjects("Table1").ListRows.Add
ActiveSheet.Protect Password:="XXX"

'"DETAILS" tab row add
Sheets("DETAILS").Unprotect Password:="XXX"
Sheets("DETAILS").ListObjects("Table11").ListRows.Add
Sheets("DETAILS").Protect Password:="XXX"

'"SUMMARY" tab row add
Sheets("SUMMARY").Unprotect Password:="XXX"
Sheets("SUMMARY").ListObjects("Table17").ListRows.Add
Sheets("SUMMARY").Protect Password:="XXX"

''"REPORT" tab row add
Sheets("REPORT").Unprotect Password:="XXX"
Sheets("REPORT").ListObjects("Table14").ListRows.Add
Sheets("REPORT").Protect Password:="XXX"

'Make sure to bring user back to the "OVERVIEW" tab
ActiveWorkbook.Sheets("OVERVIEW").Activate
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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