NamedRange.EntireColumn Property

Definition

Gets a Range that represents the entire column (or columns) that contains the NamedRange control.

public:
 property Microsoft::Office::Interop::Excel::Range ^ EntireColumn { Microsoft::Office::Interop::Excel::Range ^ get(); };
public Microsoft.Office.Interop.Excel.Range EntireColumn { get; }
member this.EntireColumn : Microsoft.Office.Interop.Excel.Range
Public ReadOnly Property EntireColumn As Range

Property Value

A 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.

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;
}
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

Applies to