iEndrow = ThisWorkbook.Sheets("Summary").Range("A4").End(xlDown).Row
Range(Cells(iEndrow + 1, "A"), Cells(iEndrow + 1, "A")).FormulaR1C1 = "Total"
Range(Cells(iEndrow + 1, "C"), Cells(iEndrow + 1, "C")).FormulaR1C1 = "=SUM(R[-20]C:R[-1]C)"
"=SUM(R[-20]C:R[-1]C)"這段代碼是固定死列數的我怎麼才能動態獲取到它的列數來sum
Range(Cells(iEndrow + 1, "C"), Cells(iEndrow + 1, "C")).FormulaR1C1 = WorksheetFunction.Sum(Range(Cells(4, "C"), Cells(iEndrow, "C")))
好吧沒人知道!改為後台自動運算了。不放公式了。