Hi i am trying to a part of my macro where the autofill function is used on one column.

I have used the following line to find the last row in the spreadsheet:

lastrow = Cells(Rows.Count, "A").End(xlup).Row + 1

then i want to autofill the column J after i have put in the 1st value into cell J2

Selection.AutoFill Destination:=Range("J2" & lastrow), Type:=xlFillDefault

it comes up with Method range of object global failed

Please help!