I am trying to create a macro that will autofill three columns worth of formulas until the end of that range and then repeat those formulas for each range below it. For context, the file is a compilation of thousands of different series that could have as little as one line, or as many as dozens. Each series is split up by one blank row, so if the first range is from A1:U7, the next range would start in A9 and go to U(x), with x being whatever row the next block ends on, an so on. I have copied and pasted the code I have written so far, just need to find a way to autofill these formulas just until the end of the current range, and then loop that so it will run the same formulas for all the ranges below that are separated by one blank row
ActiveCell.FormulaR1C1 = "=DATE(YEAR(RC[-22]),MONTH(RC[-22]),DAY(RC[-22]))"
Range("AB2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(RC[-18])=FALSE,IF(RC[-1]<RC[-18],RC[-1],""DONE""),RC[-1])"
Range("AC2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=RC[-8],RC[-1],""ERROR"")"
Range("AA3").Select
ActiveCell.FormulaR1C1 = _
"=DATE(YEAR(R[-1]C),MONTH(R[-1]C)+R[-1]C[-20],DAY(R[-1]C))"
Range("AB3").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(R[-1]C[-18])=FALSE,IF(R[-1]C[-1]<R[-1]C[-18],R[-1]C[-1],""DONE""),R[-1]C[-1])"
Range("AC3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-1]=R[-1]C[-8],R[-1]C[-1],""ERROR"")"
Columns("AA:AC").Select
Selection.NumberFormat = "m/d/yy"
ActiveCell.FormulaR1C1 = "=DATE(YEAR(RC[-22]),MONTH(RC[-22]),DAY(RC[-22]))"
Range("AB2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(RC[-18])=FALSE,IF(RC[-1]<RC[-18],RC[-1],""DONE""),RC[-1])"
Range("AC2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=RC[-8],RC[-1],""ERROR"")"
Range("AA3").Select
ActiveCell.FormulaR1C1 = _
"=DATE(YEAR(R[-1]C),MONTH(R[-1]C)+R[-1]C[-20],DAY(R[-1]C))"
Range("AB3").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(R[-1]C[-18])=FALSE,IF(R[-1]C[-1]<R[-1]C[-18],R[-1]C[-1],""DONE""),R[-1]C[-1])"
Range("AC3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-1]=R[-1]C[-8],R[-1]C[-1],""ERROR"")"
Columns("AA:AC").Select
Selection.NumberFormat = "m/d/yy"