NamedRange.Column, propriété

Obtient le numéro de la première colonne de la première zone du contrôle NamedRange.

Espace de noms :  Microsoft.Office.Tools.Excel
Assembly :  Microsoft.Office.Tools.Excel (dans Microsoft.Office.Tools.Excel.dll)

Syntaxe

'Déclaration
ReadOnly Property Column As Integer
    Get
int Column { get; }

Valeur de propriété

Type : System.Int32
Numéro de la première colonne dans la première zone du contrôle NamedRange.La colonne A retourne 1, la colonne B retourne 2, etc.

Exemples

L'exemple de code suivant crée un NamedRange et utilise les propriétés Column et Row pour afficher les numéros de la première colonne et de la première ligne dans NamedRange.

Cet exemple illustre une personnalisation au niveau du document.

    Private columnAndRowRange As Microsoft.Office.Tools.Excel.NamedRange

    Private Sub DisplayColumnAndRow()
        columnAndRowRange = Me.Controls.AddNamedRange( _
            Me.Range("A3", "D6"), "columnAndRowRange")
        MessageBox.Show("The first column in the range is column " & _
            Me.columnAndRowRange.Column.ToString() & _
            " and the first row is " & _
            Me.columnAndRowRange.Row.ToString())
    End Sub

Microsoft.Office.Tools.Excel.NamedRange columnAndRowRange;
private void DisplayColumnAndRow()
{
    columnAndRowRange = this.Controls.AddNamedRange(
        this.Range["A3", "D6"], "columnAndRowRange");
    MessageBox.Show("The first column in the range is column " +
        this.columnAndRowRange.Column.ToString() + 
        " and the first row is " +
        this.columnAndRowRange.Row.ToString());
}

Sécurité .NET Framework

Voir aussi

Référence

NamedRange Interface

Microsoft.Office.Tools.Excel, espace de noms