Test if the row count is equal to or lower than zero with an if statement:
Dim numRows As Long
With Sheets("Yoursheetname")
numRows = .Cells(.Rows.Count, "A").End(xlUp).Row
If Not numRows <= 1 Then .Cells(1, 12).AutoFill Destination:=.Range(.Cells(1, 12), .Cells(numRows, 12)), Type:=xlFillDefault
End With
As per my comment, you could also use On Error Resume Next
:
Dim numRows As Long
numRows = Cells(Rows.Count, "A").End(xlUp).Row
On Error Resume Next 'turn of error handling for the next statement
Selection.AutoFill Destination:=Range(Cells(1, 12), Cells(numRows, 12)), Type:=xlFillDefault
On Error GoTo 0 'turn error handling back on
Edit: as per @Peh's comment, the first one is preferred, as turning off error handling (even for one statement) might become problematic if you code has (or develops) any other issues.