Set formula to a range of cells

后端 未结 6 2026
日久生厌
日久生厌 2020-12-03 03:40

this is simple demo of what i want to do. I want to set a formula to a range of cells(eg. C1 to C10).

Range(\"C1\").Formula = \"=A1+B1\"

bu

6条回答
  •  萌比男神i
    2020-12-03 03:45

    Use FormulaR1C1:

    Cells((1,3),(10,3)).FormulaR1C1 = "=RC[-2]+RC[-1]"
    

    Unlike Formula, FormulaR1C1 has relative referencing.

提交回复
热议问题