Auto Format Method

Enum XlRangeAutoFormat xlRangeAutoFormat3DEffects1 = 13 xlRangeAutoFormat3DEffects2 = 14 xlRangeAutoFormatAccountingl = 4 xlRangeAutoFormatAccounting2 = 5 xlRangeAutoFormatAccounting3 = 6 xlRangeAutoFormatAccounting4 = 17 xlRangeAutoFormatClassicl = 1 xlRangeAutoFormatClassic2 = 2 xlRangeAutoFormatClassic3 = 3 xlRangeAutoFormatClassicPivotTable = 31 xlRangeAutoFormatColor1 = 7 xlRangeAutoFormatColor2 = 8 xlRangeAutoFormatColor3 = 9 xlRangeAutoFormatList1 = 10 xlRangeAutoFormatList2 = 11 xlRangeAutoFormatList3 = 12 xlRangeAutoFormatLocalFormat1 = 15 xlRangeAutoFormatLocalFormat2 = 16 xlRangeAutoFormatLocalFormat3 = 19 xlRangeAutoFormatLocalFormat4 = 2 0 xlRangeAutoFormatNone = -4142 xlRangeAutoFormatPTNone = 42 xlRangeAutoFormatReport1 = 21 xlRangeAutoFormatReport10 = 30 xlRangeAutoFormatReport2 = 22 xlRangeAutoFormatReport3 = 23 xlRangeAutoFormatReport4 = 24 xlRangeAutoFormatReport5 = 25 xlRangeAutoFormatReport6 = 2 6 xlRangeAutoFormatReport7 = 27 xlRangeAutoFormatReport8 = 2 8 xlRangeAutoFormatReport9 = 2 9 xlRangeAutoFormatSimple = -4154 xlRangeAutoFormatTable1 = 32 xlRangeAutoFormatTable10 = 41 xlRangeAutoFormatTable2 = 33 xlRangeAutoFormatTable3 = 34 xlRangeAutoFormatTable4 = 35 xlRangeAutoFormatTable5 = 36 xlRangeAutoFormatTable6 = 37 xlRangeAutoFormatTable7 = 38 xlRangeAutoFormatTable8 = 39 xlRangeAutoFormatTable9 = 4 0

End Enum

Note that the constants marked as not used are not used in the U.S. English version of Excel.

The other parameters are Boolean and should be set to True (the default values) to include the corresponding format feature, as follows:

Number

Include number formats

Font

Include font formats

Alignment

Include alignment

Border

Include border formats Pattern

Include pattern formats

Width

Include column width and row height in the autoformat

Note that if the range is a single cell, the AutoFormat method also formats the current region containing the cell. (The CurrentRegion property and the current region are discussed in detail later in this section.) Put another way, the following two statements are equivalent:

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

0 0

Post a comment