I am auto generating a spreadsheet via VBA with budgetary data. The rows are variable. I use the following code for an R1C1 formula. Variable r is a row counter.
'-----------------
'Subtotal formula
'-----------------
'Build formula string
formulaString = "=SUBTOTAL(109"
For i = 13 To r - 13
formulaString = formulaString & ",R[" & i & "]C"
i = i + 11
Next i
formulaString = formulaString & ")"
'Subtotal formulas
.Range("I5:U6").FormulaR1C1 = formulaString
This works great until the references exceed 254. Is there an easy way build this R1C1 formula such that: For each cell in range I5:U6, SUBTOTAL 109 every 13th row beneath to max row? If there is an easy answer could you please explain it step by step? Thanks.