Formatiert den angegebenen Bereich automatisch mit einem vordefinierten Format.
Syntax
Ausdruck.AutoFormat(Format, Number, Font, Alignment, Border, Pattern, Width)
Ausdruck Erforderlich. Ein Ausdruck, der ein Range-Objekt zurückgibt.
Format Variant optional. Das angegebene AutoFormat. Zulässig ist eine der folgenden XlRangeAutoFormat-Konstanten:
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 |
Die Standardkonstante ist xlRangeAutoFormatClassic1. Einige dieser Konstanten stehen Ihnen, abhängig von der ausgewählten oder installierten Sprachunterstützung (z. B. Deutsch), möglicherweise nicht zur Verfügung.
Number Variant optional. True, wenn Zahlenformate in die automatische Formatierung mit aufgenommen werden. Der Standardwert ist True.
Font Variant optional. True, wenn Schriftformate in die automatische Formatierung mit aufgenommen werden. Der Standardwert ist True.
Alignment Variant optional. True, wenn die Ausrichtung in die automatische Formatierung mit aufgenommen wird. Der Standardwert ist True.
Border Variant optional. True, wenn Rahmenformatierung in die automatischen Formatierung mit aufgenommen wird. Der Standardwert ist True.
Pattern Variant optional. True, wenn Musterformatierung in die automatischen Formatierung mit aufgenommen wird. Der Standardwert ist True.
Width Variant optional. True, wenn Spaltenbreite und Zeilenhöhe in die automatischen Formatierung mit aufgenommen werden. Der Standardwert ist True.
Anmerkungen
Handelt es sich bei dem Bereich um eine einzelne Zelle, so formatiert diese Methode auch den aktiven Bereich, der die Zelle umgibt, d. h. die beiden folgenden Anweisungen sind gleichbedeutend:
Cells("A1").AutoFormat Cells("A1").CurrentRegion.AutoFormat