Style Property

Microsoft Excel Visual Basic

Show All

Style Property

       

 Style property as it applies to the LineFormat object.

Returns a Style object that represents the style of the specified range. Read/write MsoLineStyle.

MsoLineStyle can be one of these MsoLineStyle constants.
msoLineSingle
msoLineThickBetweenThin
msoLineThinThick
msoLineStyleMixed
msoLineThickThin
msoLineThinThin

expression.Style

expression   Required. An expression that returns one of the above objects.

 

 Style property as it applies to the Range object.

Returns a Style object that represents the style of the specified range. Read/write Variant.

expression.Style

expression   Required. An expression that returns one of the above objects.

Example

As it applies to the Range object.

This example applies the Normal style to cell A1 on Sheet1.

Worksheets("Sheet1").Range("A1").Style.Name = "Normal"

If cell B4 on Sheet1 currently has the Normal style applied, this example applies the Percent style.

If Worksheets("Sheet1").Range("B4").Style.Name = "Normal" Then
    Worksheets("Sheet1").Range("B4").Style.Name = "Percent"
End If