Trying to execute below code:
ActiveCell.Offset(1, 0).Select 'Noting but F2
ActiveCell.FormulaR1C1 = "=LEFT(RC[-1],4)"
' find last row with data in column "A"
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
' copying the formula from "F2" all the way to the last cell
ActiveCell.AutoFill Destination:=Range(ActiveCell.EntireColumn & lastRow), Type:=xlFillDefault
It gives an error saying type mismatch.
But when I try:
ActiveCell.AutoFill Destination:=Range("F2:F" & lastRow), Type:=xlFillDefault
It works properly, but I don't want F2:F there, as I don't know which column will be in future.