I have a formula (I2-J2) in cell K2 and I want Excel to Copy that down till the last row of my data set. So take the formula in K2 and copy it to K3, K4, K5 and so on. Which row is the last row changes dynamically each month based on the data set so I cant use fixed values.
I already tried the other solution in a similar thread: Fill formula down till last row in column but that unfortunately did not work.
Sub Autofill()
Dim LastRow As Long
LastRow = Range("K" & Rows.Count).End(xlUp).Row
Range("K2:K" & LastRow).Formula = I2 - J2
End Sub
The macro already stops in cell K2, which is not the end of my data set and even the formula gives out the wrong result 0 instead of value in I2 minus value in J2
What did I do wrong here?
Many thanks!
Range("K2:K" & LastRow).Formula = "=I2 - J2"- Scott Craner