NamedRange.Cells Property (2007 System)
Gets a Range that represents the cells in the NamedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Cells As Range
'Usage
Dim instance As NamedRange
Dim value As Range
value = instance.Cells
[BrowsableAttribute(false)]
public Range Cells { get; }
[BrowsableAttribute(false)]
public:
property Range^ Cells {
Range^ get ();
}
public function get Cells () : Range
Property Value
Type: Range
A Range that represents the 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.
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
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.");
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.