(Solved) – using a variable in an R1C1 formula


This formula works:
ActiveCell.FormulaR1C1 = "=SUM(R[-14]C:R[-1]C)"
it returns =sum(c1:c14)

This formula does not work:
ActiveCell.FormulaR1C1 = "=SUM(R[-" & nrows & "]C:R[-1]C)"
It returns =SUM(C14:C1048576)

I have this statement

Dim nrows as Integer

why does the formula with the nrows variable not work

Leave a Reply

Your email address will not be published. Required fields are marked *