I have a formula in Column A2. I have a table similar to this:
Formula | Note | Datum | I am very happy because I am | Years | years old |
---|---|---|---|---|---|
=CONCATENATE(TEXT(C2;"dd-mm-yyyy");$D$1;E2;$F$1) | Any word, TEXT | 01.04.2021 | 21 | ||
Autofill | Any word, TEXT 2 | 01.04.2021 | 25 |
I want to transfer it and use it automatically for the whole column. However, I tried possible and impossible ways to do it, but none of them worked. I also looked at forums such as here:
I don't have all the data filled in the table, so I want "excel" to look for the last row in which the record is and try to calculate the formula and return it to the last cell in column A.
Thank you in advance for all the help
(The formula joins the text together) =CONCATENATE(TEXT(C2;"dd-mm-yyyy");$D$1;E2;$F$1)
Sub AutofilCol()
' Apply to the entire column Autofill
Range("A1").Offset(1, 0).Activate
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(TEXT(RC[2],""dd-mm-yyyy""),R1C4,RC[4],R1C6)"
' AutoFill
Selection.AutoFill Destination:=Range("A2:A").End(xlDown).Row
ActiveCell.EntireColumn.AutoFit
End Sub