AutoFormat Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

                 

Automatically formats the specified range, 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 specified autoformat. Can be one of the following XlRangeAutoFormat constants:

xlRangeAutoFormat3DEffects1

xlRangeAutoFormat3DEffects2

xlRangeAutoFormatAccounting1

xlRangeAutoFormatAccounting2

xlRangeAutoFormatAccounting3

xlRangeAutoFormatAccounting4

xlRangeAutoFormatClassic1

xlRangeAutoFormatClassic2

xlRangeAutoFormatClassic3

xlRangeAutoFormatClassicPivotTable

xlRangeAutoFormatColor1

xlRangeAutoFormatColor2

xlRangeAutoFormatColor3

xlRangeAutoFormatList1

xlRangeAutoFormatList2

xlRangeAutoFormatList3

xlRangeAutoFormatLocalFormat1

xlRangeAutoFormatLocalFormat2

xlRangeAutoFormatLocalFormat3

xlRangeAutoFormatLocalFormat4

xlRangeAutoFormatNone

xlRangeAutoFormatPTNone

xlRangeAutoFormatReport1

xlRangeAutoFormatReport2

xlRangeAutoFormatReport3

xlRangeAutoFormatReport4

xlRangeAutoFormatReport5

xlRangeAutoFormatReport6

xlRangeAutoFormatReport7

xlRangeAutoFormatReport8

xlRangeAutoFormatReport9

xlRangeAutoFormatReport10

xlRangeAutoFormatSimple

xlRangeAutoFormatTable1

xlRangeAutoFormatTable2

xlRangeAutoFormatTable3

xlRangeAutoFormatTable4

xlRangeAutoFormatTable5

xlRangeAutoFormatTable6

xlRangeAutoFormatTable7

xlRangeAutoFormatTable8

xlRangeAutoFormatTable9

xlRangeAutoFormatTable10

The default constant is xlRangeAutoFormatClassic1. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that youve selected or installed.

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 active region surrounding the cell. In other words, the following two statements are equivalent:

Cells("A1").AutoFormat
Cells("A1").CurrentRegion.AutoFormat