Something like this
Sub Macro1()
Dim irow As Long
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For irow = 2 To LR
Cells(irow, 4).FormulaR1C1 = "=IF(ISBLANK(RC[-1]),"""",DATE(YEAR(RC[-1]),MONTH(RC[-1]),DAY(RC[-1])))"
Next irow
End Sub
I'm making a guess the formula in going in D2 and down to the last row of some column.
Without looping it could also be written as
Sub Macro2()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("D2:D" & LR).FormulaR1C1 = "=IF(ISBLANK(RC[-1]),"""",DATE(YEAR(RC[-1]),MONTH(RC[-1]),DAY(RC[-1])))"
End Sub
Bookmarks