Excel Autofill Method of Range Class Failed
Trying to Use the Code below to autofill a selection. Error comes up when
executed, code is in a loop in which i is the number of the row. Set sourceRange = Worksheets("Ref. PGW").Range(Sheets("Ref. PGW").Cells(i - 1, 8), Sheets("Ref. PGW").Cells(i - 1, 10)) Set fillRange = Worksheets("Ref. PGW").Range(Sheets("Ref. PGW").Cells(i, 8), Sheets("Ref. PGW").Cells(i, 10)) sourceRange.AutoFill Destination:=fillRange, Type:=xlFillDefault Thanks, Steve |
Excel Autofill Method of Range Class Failed
Steve,
The autofiill method requires that the Destination Range includes the source range. But, you could use SourceRange.Copy FillRange or SourceRange.Copy SourceRange.Offset(1,0) or sourceRange.AutoFill Destination:=Range(sourceRange,fillRange), Type:=xlFillDefault HTH, Bernie MS Excel MVP "Steve" wrote in message ... Trying to Use the Code below to autofill a selection. Error comes up when executed, code is in a loop in which i is the number of the row. Set sourceRange = Worksheets("Ref. PGW").Range(Sheets("Ref. PGW").Cells(i - 1, 8), Sheets("Ref. PGW").Cells(i - 1, 10)) Set fillRange = Worksheets("Ref. PGW").Range(Sheets("Ref. PGW").Cells(i, 8), Sheets("Ref. PGW").Cells(i, 10)) sourceRange.AutoFill Destination:=fillRange, Type:=xlFillDefault Thanks, Steve |
All times are GMT +1. The time now is 12:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com