I have a macro where it autofills based on the last active row of Column C to fill 2020 in Column A and GM BCR in Column B. However I am getting an "Autofill range of class failed" error when the data only has one row. I tried to write an If statement but it said object required.
'Drag down 2020 & GM BCR'
Range("B" & ActiveCell.Row).Select
ActiveCell.FormulaR1C1 = "GM BCR"
Dim lastRow As Long
lastRow = Range("C" & Rows.Count).End(xlUp).Row
ActiveCell.AutoFill Destination:=Range(ActiveCell, Cells(Cells(Rows.Count, "C").End(xlUp).Row, "B"))
Range("A" & ActiveCell.Row).Select
ActiveCell.FormulaR1C1 = "2020"
Dim lastRow1 As Long
lastRow1 = Range("C" & Rows.Count).End(xlUp).Row
ActiveCell.AutoFill Destination:=Range(ActiveCell, Cells(Cells(Rows.Count, "C").End(xlUp).Row, "A"))
I know my code is probably not optimal but that was the best I could do while tight on time unfortunately. Does anyone know how to fix it so that if I have only one line of data it could still input a single line?