I want to use a macro to place a formula into my spreadsheet, the range of which I want to define based upon the contents of a cell. As example, having entered a 6 into cell A11 on my Inputs worksheet, I want my formula to use six rows of data from my Data worksheet, like this: =LINEST(Data!E2:E7,Data!F2:F7). I later copy the formula so I want to keep the cell references relative. With the help of Record Macro, I found out I have to use ActiveCell.FormulaR1C1 = "=LINEST(Data!RC:RC,Data!RC:RC)". Works great if I don't mind editing the macro whenever I want a bigger or smaller range. After throwing all kinds of code at the problem (STR function, RIGHT function, even ConvertFormula) I still canât seem to get it right. Anyone out there that can help?