Hello,
I am looking to copy a formula down a column range, but I only want the formula to be copied until the last cell with data. Essentially, I'm trying to use some type of untilblank() functionality.
I need to do this for about 7 - 8 columns in the worksheet, and each of the formulas are different for each of the columns.
Any assistance would be greatly appreciated.
Here's what I have so far (and I don't want to use this type of coding practice because I know it will slow down the run time of my macro overall):
Range("AJ2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(AND(RC[-14]>=38626,RC[-14]<=38990),""Y1"",IF(AND(RC[-14]>=38991,RC[-14]<=39355),""Y2"",IF(AND(RC[-14]>=39356,RC[-14]<=39721),""Y3"",IF(AND(RC[-14]>=39722,RC[-14]<=40086),""Y4"",IF(AND(RC[-14]>=40087,RC[-14]<=40451),""Y5"",IF(AND(RC[-14]>=40452,RC[-14]<=40816),""Y6"",""""))))))"
Range("AJ2").Select
Selection.AutoFill Destination:=Range("AJ2:AJ65536")
I am looking to copy a formula down a column range, but I only want the formula to be copied until the last cell with data. Essentially, I'm trying to use some type of untilblank() functionality.
I need to do this for about 7 - 8 columns in the worksheet, and each of the formulas are different for each of the columns.
Any assistance would be greatly appreciated.
Here's what I have so far (and I don't want to use this type of coding practice because I know it will slow down the run time of my macro overall):
Range("AJ2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(AND(RC[-14]>=38626,RC[-14]<=38990),""Y1"",IF(AND(RC[-14]>=38991,RC[-14]<=39355),""Y2"",IF(AND(RC[-14]>=39356,RC[-14]<=39721),""Y3"",IF(AND(RC[-14]>=39722,RC[-14]<=40086),""Y4"",IF(AND(RC[-14]>=40087,RC[-14]<=40451),""Y5"",IF(AND(RC[-14]>=40452,RC[-14]<=40816),""Y6"",""""))))))"
Range("AJ2").Select
Selection.AutoFill Destination:=Range("AJ2:AJ65536")