I am trying to copy a cell in row 'A' down to a variable number of rows. The code generates the error message: "AutoFill method of range class failed". y and z are declared Integer's. The applicable portion of the code is below. Basically, find 'z', do a couple of copy pastes, then find 'y', then do the autofill. It's the last line that causes the problem.
All help is appreciated. Thanks, Cliff
z = Workbooks("master.xlsm").Worksheets("sheet1").Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row + 4
Workbooks("master.xlsm").Worksheets("sheet1").Range("A" & z) = b & " " & Worksheets(c).Name
'Puts target files name in Column A and row found above = z.
Workbooks("master.xlsm").Worksheets("sheet1").Range("B" & z).PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False 'Puts used range that was copied to the right of file name.
y = Workbooks("master.xlsm").Worksheets("sheet1").Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
Workbooks("master.xlsm").Worksheets("sheet1").Range("A" & z).AutoFill Destination:=Range("A" & z & ":A" & y), Type:=xlFillDefault
Bookmarks