Applies To
Range Object.
Description
Performs an autofill on the cells in the range.
Syntax
object.AutoFill(destination, type)
object
Required. The source range.
destination
Required. A Range object that represents the cells to fill. The object must include the source range.
type
Optional. Can be one of xlFillDefault, xlFillSeries, xlFillCopy, xlFillFormats, xlFillValues, xlFillDays, xlFillWeekdays, xlFillMonths, xlFillYears, xlLinearTrend, xlGrowthTrend. If xlFillDefault or omitted, the method selects the most appropriate type based on the source range.
Example
This example performs an autofill on cells A1:A20 on Sheet1, based on the source range of A1:A2 on Sheet1. Before running this example, type 1 in cell A1 and type 2 in cell A2.
Set sourceRange = Worksheets("Sheet1").Range("A1:A2") Set fillRange = Worksheets("Sheet1").Range("A1:A20") sourceRange.AutoFill destination:=fillRange