This topic has not yet been rated - Rate this topic

How to: Clear Styles from Ranges in Workbooks

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

  • Application-level projects

Microsoft Office version

  • Excel 2003

  • Excel 2007

For more information, see Features Available by Application and Project Type.

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.

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.

    this.rangeStyles.Style = "Normal";
    

To clear the styles in a workbook range

  • Apply the Normal style to the range.

    Excel.Range rng = this.Application.get_Range("A1", missing);
    rng.Style = "Normal";
    
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.