Export (0) Print
Expand All

Range.AutoFill Method

Office 2007
Performs an autofill on the cells in the specified range.

Syntax

expression.AutoFill(Destination, Type)

expression   A variable that represents a Range object.

Parameters

NameRequired/OptionalData TypeDescription
DestinationRequiredRangeThe cells to be filled. The destination must include the source range.
TypeOptionalXlAutoFillTypeSpecifies the fill type.

Return Value
Variant

Example

This example performs an autofill on cells A1:A20 on Sheet1, based on the source range A1:A2 on Sheet1. Before running this example, type 1 in cell A1 and type 2 in cell A2.

Visual Basic for Applications
Set sourceRange = Worksheets("Sheet1").Range("A1:A2")
Set fillRange = Worksheets("Sheet1").Range("A1:A20")
sourceRange.AutoFill Destination:=fillRange



Community Additions

ADD
Show:
© 2014 Microsoft