This video demonstrates how to record a macro in Excel that will work across tables that have a different number of rows.

To acheive this you need to know about relative vs absolute referencing when recording a macro
You will also need to know some clever shortcut keys that allow you to select values in a column or move to the last value in a columm
Lastly you need to know about a small change that can be made to the AUTOSUM function that will make the formula work for differnet sized ranges.
------------------------