Home |
Search |
Today's Posts |
#7
![]() |
|||
|
|||
![]()
Bernie,
Perfect! Thanks a lot! "Bernie Deitrick" wrote: Danny, Try this version. Sub SumInActiveCell() With ActiveCell .Formula = "=SUM(" & _ Range(.Offset(-1, 0), _ .Offset(-1, 0).End(xlUp)).Address(False, False) & ")" End With End Sub HTH, Bernie MS Excel MVP "Danny" wrote in message ... Hi Bernie, I tried the formula and sometimes it works. It also jumps one cell below. It there a simple way to modify the original formula to make "-4" variable? ActiveCell.FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)" "Bernie Deitrick" wrote: Danny, Sub SumAtBottomOfCurrentColumn() Dim myCell As Range Set myCell = Cells(65536, ActiveCell.Column).End(xlUp)(2) 'Uncomment this section to sum from a consistent row: in this example, row 2 'And comment out the lower section of code 'With myCell ' .Formula = "=SUM(" & _ ' Range(.Offset(-1, 0), _ ' Cells(2, .Column)).Address(False, False) & ")" 'End With 'Use this to sum the block up from the lowest cell With myCell .Formula = "=SUM(" & _ Range(.Offset(-1, 0), _ .Offset(-1, 0).End(xlUp)).Address(False, False) & ")" End With End Sub HTH, Bernie MS Excel MVP "Danny" wrote in message ... Hi, Before I posted this question, I researched on similar questions on this NG and I didn't get the answer I needed. All I need is a formula that would sum numbers above the active cell. This is the formula I have. ActiveCell.FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)" It works but it is only good if there are four or less numbers above it. What I need is a formula for variable numbers to add. Thank you. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
How do I find a file/spreadsheet that Excel says is Already open but I can't find it? | Excel Discussion (Misc queries) | |||
Stop Excel Rounding Dates | Excel Discussion (Misc queries) | |||
Hints And Tips For New Posters In The Excel Newsgroups | Excel Worksheet Functions | |||
Difference in number of Excel NewsGroups | Excel Discussion (Misc queries) |