I'm new to VBA and I'm having trouble understanding where my code is falling down. I receive the message "Autofill method of Range class failed"
. Please Help me to solve
Code:
Sub SomeName()
Dim lRow As Long
Dim wb As Workbook: Set wb = ThisWorkbook
Dim wkSheet As Worksheet
Set wkSheet = wb.ActiveSheet
lRow = wkSheet.Range("G" & wkSheet.Rows.Count).End(xlUp).Row
Sheets("MilestoneStatus").Select
lRow = wkSheet.Range("G" & wkSheet.Rows.Count).End(xlUp).Row
wkSheet.Range("H1").Formula = "=IF(ISBLANK(RC[-1]),"""",IF(DAYS(TODAY(),RC[-1])<0,CONCATENATE(""Due in "",-DAYS(TODAY(),RC[-1]),""DAYS""),IF(DAYS(TODAY(),RC[-1])>0,CONCATENATE(""OVERDUE"",DAYS(TODAY(),RC[-1]),""DAYS""),""Due today"")))"
With wkSheet.Range("H1")
.Formula = Range("H1").Formula
.AutoFill Destination:=Range.Offset(0, 0).Resize(lRow)
End With
End Sub