NamedRange.Count Property  
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the number of cells in the NamedRange control.
public:
 property int Count { int get(); };
	public int Count { get; }
	member this.Count : int
	Public ReadOnly Property Count As Integer
	Property Value
The number of cells in the NamedRange control.
Examples
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.");
}
Private compositeRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub DisplayRangeComposition()
    compositeRange = Me.Controls.AddNamedRange( _
        Me.Range("B2", "E5"), "compositeRange")
    compositeRange.Cells.Interior.Color = &HFF00
    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.")
End Sub