Partager via


Range.AutoFormat Method

Automatically formats the specified range, using a predefined format.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function AutoFormat ( _
    Format As XlRangeAutoFormat, _
    Number As Object, _
    Font As Object, _
    Alignment As Object, _
    Border As Object, _
    Pattern As Object, _
    Width As Object _
) As Object
'Usage
Dim instance As Range
Dim Format As XlRangeAutoFormat
Dim Number As Object
Dim Font As Object
Dim Alignment As Object
Dim Border As Object
Dim Pattern As Object
Dim Width As Object
Dim returnValue As Object

returnValue = instance.AutoFormat(Format, _
    Number, Font, Alignment, Border, Pattern, _
    Width)
Object AutoFormat(
    XlRangeAutoFormat Format,
    Object Number,
    Object Font,
    Object Alignment,
    Object Border,
    Object Pattern,
    Object Width
)

Parameters

  • Number
    Type: System.Object

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

  • Font
    Type: System.Object

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

  • Alignment
    Type: System.Object

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

  • Border
    Type: System.Object

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

  • Pattern
    Type: System.Object

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

  • Width
    Type: System.Object

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

Return Value

Type: System.Object

Remarks

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

See Also

Reference

Range Interface

Range Members

Microsoft.Office.Interop.Excel Namespace