1
我知道如何找到最後一行,並在其中添加了一個SUM()
,但我如何在O
列中使用SUM(G+H)
?使用範圍的特定行總和
我會用它來得到最後一行和總和列,這怎麼可能轉換爲總和行?
With ws
If Application.WorksheetFunction.CountA(.Cells) <> 0 Then
LastRow = .Cells.Find(What:="*", _
After:=.Range("A1"), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
Else
LastRow = 1
End If
.Range("C" & LastRow + 1).FormulaR1C1 = "=SUM(R[-" & LastRow & "]C:R[-1]C)"
.Range("C" & LastRow + 1 & ":M" & LastRow + 1).FillRight
End With
FWIW - '」 = SUM(R [ - 「&LastRow&」] C:R [-1] C)「'可以簡化爲'」= SUM(R1C:R [-1] C)「' - 公式將原來的單元格C1開始,而另一種方法將從單元格C $ 1開始,但是差別在於如果你使用它的方式,相對或絕對行地址應該不重要。 – YowE3K