ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Go to cell below last entry in column and total (https://www.excelbanter.com/excel-worksheet-functions/240856-go-cell-below-last-entry-column-total.html)

Donna[_2_]

Go to cell below last entry in column and total
 
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

Jacob Skaria

Go to cell below last entry in column and total
 
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
---------------
Jacob Skaria


"Donna" wrote:

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



All times are GMT +1. The time now is 07:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com