How to: Clear Styles from Ranges in Workbooks

You can clear styles that have been added to a NamedRange control or a native Excel range object by applying the Normal style to the range.

Applies to: The information in this topic applies to document-level projects and application-level projects for Excel 2007 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

Clearing Styles from a NamedRange Control

This example assumes that you have a NamedRange control named rangeStyles on the worksheet. The following code must be placed in a sheet class, not in the ThisWorkbook class.

To clear the styles in a NamedRange control

  • Apply the Normal style to the range. This code must be placed in a sheet class, not in the ThisWorkbook class.

    Me.rangeStyles.Style = "Normal"
    
    this.rangeStyles.Style = "Normal";
    

Clearing Styles from a Native Excel Object

To clear the styles in a workbook range

  • Apply the Normal style to the range.

    Dim rng As Excel.Range = Me.Application.Range("A1")
    rng.Style = "Normal"
    
    Excel.Range rng = this.Application.get_Range("A1", missing);
    rng.Style = "Normal";
    

See Also

Tasks

How to: Apply Styles to Ranges in Workbooks

Concepts

Working with Ranges

NamedRange Control

Optional Parameters in Office Solutions