I want to pick the number of rows dynamically for my standard deviation calculation in VBA.
Currently I have the following code:
Sub Stdev()
Dim x as integer
x=10
Range("E1").Select
ActiveCell.FormulaR1C1 = "=STDEV(R[1]C:R[5]C)"
Range("E1").Select
ActiveCell.FormulaR1C1 = "=STDEV(R[1]C:R[x]C)"'this is my attempt at dynamic calculation
End Sub
How do I correct it to select the number of rows as specified in x?