Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

NamedRange.Count Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets the number of cells in the NamedRange control.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
int Count { get; }

Property Value

Type: System.Int32
The number of cells in the NamedRange control.

The following code example creates a NamedRange and colors the interior green. It then displays a series of messages that show how many cells, columns, and rows are in the NamedRange.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange compositeRange;
private void DisplayRangeComposition()
{
    compositeRange = this.Controls.AddNamedRange(
        this.Range["B2", "E5"], "compositeRange");
    compositeRange.Cells.Interior.Color = 0xFF00;
    MessageBox.Show("The range has " + compositeRange.Count + 
        " cells.");
    MessageBox.Show("The range has " + 
        compositeRange.Columns.Count + " columns.");
    MessageBox.Show("The range has " + 
        compositeRange.Rows.Count + " rows.");
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.