ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB to AutoSum (https://www.excelbanter.com/excel-programming/376572-vbulletin-autosum.html)

rlee1999

VB to AutoSum
 
In the following, the last action is to sum Row 2:Row 1889. Row 1889 varies
each time I run the report. I am looking for some way to either AutoSum in
the active cell or count the number of rows above the active cell (minus the
header row) and insert that number in the place of 1889. Help Please. ~Robert

Columns("L:L").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 23).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-1889]C:R[-1]C)"


rlee1999

VB to AutoSum
 
Thank You all, but I actually found the answer in an old post

"rlee1999" wrote:

In the following, the last action is to sum Row 2:Row 1889. Row 1889 varies
each time I run the report. I am looking for some way to either AutoSum in
the active cell or count the number of rows above the active cell (minus the
header row) and insert that number in the place of 1889. Help Please. ~Robert

Columns("L:L").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 23).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-1889]C:R[-1]C)"



All times are GMT +1. The time now is 05:09 AM.

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