Range.AutoFormat Method

Definition

Automatically formats the specified range, using a predefined format.

public object AutoFormat (Microsoft.Office.Interop.Excel.XlRangeAutoFormat Format = Microsoft.Office.Interop.Excel.XlRangeAutoFormat.xlRangeAutoFormatClassic1, object Number, object Font, object Alignment, object Border, object Pattern, object Width);
Public Function AutoFormat (Optional Format As XlRangeAutoFormat = Microsoft.Office.Interop.Excel.XlRangeAutoFormat.xlRangeAutoFormatClassic1, Optional Number As Object, Optional Font As Object, Optional Alignment As Object, Optional Border As Object, Optional Pattern As Object, Optional Width As Object) As Object

Parameters

Format
XlRangeAutoFormat

Optional XlRangeAutoFormat. The specified AutoFormat.Some of the XlRangeAutoFormat constants may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

Number
Object

Optional Object. True to include number formats in the AutoFormat. The default value is True.

Font
Object

Optional Object. True to include font formats in the AutoFormat. The default value is True.

Alignment
Object

Optional Object. True to include alignment in the AutoFormat. The default value is True.

Border
Object

Optional Object. True to include border formats in the AutoFormat. The default value is True.

Pattern
Object

Optional Object. True to include pattern formats in the AutoFormat. The default value is True.

Width
Object

Optional Object. True to include column width and row height in the AutoFormat. The default value is True.

Returns

Remarks

If the range is a single cell, this method also formats the active region surrounding the cell.

Applies to