Applies To
Range object.
Description
Automatically formats a range of cells, using a predefined format.
Syntax
expression.AutoFormat(Format,Number,Font,Alignment,Border,Pattern,Width)expression Required. An expression that returns a Range object.
Format Optional Variant. The autoformat. Can be one of the following XlRangeAutoFormat constants:
xlRangeAutoFormat3DEffects1
xlRangeAutoFormat3DEffects2
xlRangeAutoFormatAccounting1
xlRangeAutoFormatAccounting2
xlRangeAutoFormatAccounting3
xlRangeAutoFormatAccounting4
xlRangeAutoFormatClassic1
xlRangeAutoFormatClassic2
xlRangeAutoFormatClassic3
xlRangeAutoFormatColor1
xlRangeAutoFormatColor2
xlRangeAutoFormatColor3
xlRangeAutoFormatList1
xlRangeAutoFormatList2
xlRangeAutoFormatList3
xlRangeAutoFormatLocalFormat1
xlRangeAutoFormatLocalFormat2
xlRangeAutoFormatLocalFormat3
xlRangeAutoFormatLocalFormat4
xlRangeAutoFormatNone
xlRangeAutoFormatSimple
The default value is xlRangeAutoFormatClassic1. The xlRangeAutoFormatLocalFormat1, xlRangeAutoFormatLocalFormat2, xlRangeAutoFormatLocalFormat3, and xlRangeAutoFormatLocalFormat4 constants are not used in U.S./English Microsoft Excel.
Number Optional Variant. True to include number formats in the autoformat. The default value is True.
Font Optional Variant. True to include font formats in the autoformat. The default value is True.
Alignment Optional Variant. True to include alignment in the autoformat. The default value is True.
Border Optional Variant. True to include border formats in the autoformat. The default value is True.
Pattern Optional Variant. True to include pattern formats in the autoformat. The default value is True.
Width Optional Variant. True to include column width and row height in the autoformat. The default value is True.
Remarks
If the range is a single cell, this method also formats the current region surrounding the cell. In other words, the following two statements are equivalent: