## GeoEqual

I want to put the total on the last row of the sheet regardless the number of the records.

If 10 rows are populated, i want to put total on 11th row.
If 12 rows are populated, i want to put total on 13th row.

If I based the adjustment on the recordcount, its not working.

## AtoDenis

Can you explain the context a bit?

## demon916 25

If you absolutely can not have the totals at the top,(which is where I place all my totals in excel), then you may have to do a 'For' 'Next' loop in order to find the last entry. (see Example 1)

Example1:

``````Dim rngCell As Range ' Create a Cell range object...
Dim tRow As Long     ' Create a variable for the totals row...
' "For" loop thru all cells in your column of choice...
For each rngCell in Sheet("Your Sheet").Range("A:A")
' Keep going till you hit a blank...
If rngCell = "" then
' Save the row number...
tRow = rngCell.Row
' Exit the "For" loop...
Exit For
End If
Next rngCell
' Enter your totals' formulas on the found last row...
``````

Although, if you are using VBA to add your entries to begin with, you could always just insert a new row and add your entry on that new row, then your formulas would just automatically shift it's range provided you always insert within your range. (see Example 2)

Example2:

``````     |     A     |     B     |     C     |     D     |
------------------------------------------------------
------------------------------------------------------
2  |   100     |    2      |      52   |    ...    |
------------------------------------------------------
3  |   200     |    5      |      34   |    ...    |
------------------------------------------------------
4  |    20     |    2      |     ...   |    ...    |
------------------------------------------------------ <--- Insert New row here...
5  |           |           |           |           | <--- Leave this row blank,
------------------------------------------------------      but include it in your formula
6  | =Sum(\$A\$2:\$A\$5) |...  |     ...   |    ...    | <--- Your formula will auto-increment.
------------------------------------------------------
``````