NamedRange.EntireColumn Property
Gets a Microsoft.Office.Interop.Excel.Range that represents the entire column (or columns) that contains the NamedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
ReadOnly Property EntireColumn As Range
Get
Range EntireColumn { get; }
Property Value
Type: Microsoft.Office.Interop.Excel.Range
A Microsoft.Office.Interop.Excel.Range that represents the entire column (or columns) that contains the NamedRange control.
Examples
The following code example creates a NamedRange and then sets the border color of the columns and rows that contain the NamedRange to green.
This example is for a document-level customization.
Private entireRowAndColumnRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub HighlightColumnAndRow()
entireRowAndColumnRange = Me.Controls.AddNamedRange( _
Me.Range("C3", "E5"), "entireRowAndColumnRange")
' Set the style of the column and row borders to xlSlantDashDot.
Me.entireRowAndColumnRange.EntireColumn.Borders.LineStyle = _
Excel.XlLineStyle.xlSlantDashDot
Me.entireRowAndColumnRange.EntireRow.Borders.LineStyle = _
Excel.XlLineStyle.xlSlantDashDot
End Sub
Microsoft.Office.Tools.Excel.NamedRange entireRowAndColumnRange;
private void HighlightColumnAndRow()
{
entireRowAndColumnRange = this.Controls.AddNamedRange(
this.Range["C3", "E5"], "entireRowAndColumnRange");
// Set the style of the column and row borders to xlSlantDashDot.
this.entireRowAndColumnRange.EntireColumn.Borders.LineStyle =
Excel.XlLineStyle.xlSlantDashDot;
this.entireRowAndColumnRange.EntireRow.Borders.LineStyle =
Excel.XlLineStyle.xlSlantDashDot;
}
.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.