I have a macro that will autofill column C with the contents of "C1" to the last used row from column A. This code works great unless row 1 is the only row. That is why I used "If Not IsEmpty("A2") Then" because I wanted it to recognize that if "A2" is empty then do not autofill. When i use this code on only 1 row then i get the error "1004: Autofil method of range class failed". Can anyone help me out with this code? Thank you.
Code:
Sub UsedRange()
Dim lastrow As Long
If Not IsEmpty("A2") Then
lastrow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
Range("C1").AutoFill Range("C1:C" & lastrow), xlFillCopy
End If
End Sub