使用VBA将公式添加到范围

我想添加一个公式到单元格的范围。 它应该乘以100的邻居单元。因此,我尝试了以下内容:

Range(Cells(row, col + 17), Cells(row + num_positions, col + 17)).Select Selection.Formula = "=100*" & Cells(row, col + 12) 

不幸的是,这不是正确的语法。 如何应用这样的行为?

编辑:

  For i = 0 To num_n v = Cells(row + i, col + 12) Cells(row + i, col+ 17).Formula = "=100*" & v Next i 

如果我用常量expression式replacev ,这个工作

使用FormulaR1C1 。 这很容易。 如果可以,避免循环,它们很慢。

 With Range(Cells(row, col + 17), Cells(row + num_positions, col + 17)) .FormulaR1C1 = "=100*RC[-5]" '100 times the cell on the same row, 5 cols left End with