please can you help with VBA code to automatically resize my table once data is added to a protected sheet? When the sheet is unlocked and I add data the table automatically resizes but when it's locked it does't resize to include any data added.
I currently have this and it inserts 1 row only, I need it to resize the table to fit the number of rows where data is added (it could be 10 rows or 100):
Sub ExtendTable()
ActiveSheet.Unprotect Password:="XXXX"
ActiveSheet.ListObjects("PortfolioTracker").ListRows.Add.Range.Locked = False
ActiveSheet.Protect Password:="XXXX"
End Sub