Go to cell below last entry in column and total

  • Thread starter Thread starter Donna
  • Start date Start date
D

Donna

I am doing a macro and I would like for it to automatically go to the cell
below last entry in a column and total. (row count will be different each
time I run the macro) One of the columns has entries in every cell,, and my
other column may have blanks cells in the column. Thanks for your help.
Donna
 
Try the below which will insert a total to Col B after last row with data in
the active sheet

Sub Macro()
Dim lngRow As Long
lngRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row + 1
Range("B" & lngRow) = "=SUM(B1:B" & lngRow - 1 & ")"
End Sub

If this post helps click Yes
 
Back
Top