NamedRange.Resize Property

Definition

Gets a resized Range based on the NamedRange control.

public:
 property Microsoft::Office::Tools::Excel::NamedRange_ResizeType ^ Resize { Microsoft::Office::Tools::Excel::NamedRange_ResizeType ^ get(); };
public Microsoft.Office.Tools.Excel.NamedRange_ResizeType Resize { get; }
member this.Resize : Microsoft.Office.Tools.Excel.NamedRange_ResizeType
Public ReadOnly Property Resize As NamedRange_ResizeType

Property Value

A resized Range based on the NamedRange control.

Examples

The following code example creates a NamedRange and then uses the Resize property to get a larger range based on the NamedRange. The code then selects the new range.

This version is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange resizeRange;
private void CreateResizedRange()
{
    resizeRange = this.Controls.AddNamedRange(
        this.Range["B2", "C4"], "resizeRange");
    Excel.Range range1 = this.resizeRange.Resize[6, 6];
    range1.Select();
}
Private resizeRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub CreateResizedRange()
    resizeRange = Me.Controls.AddNamedRange( _
        Me.Range("B2", "C4"), "resizeRange")
    Dim range1 As Excel.Range = Me.resizeRange.Resize(6, 6)
    range1.Select()
End Sub

This version is for an application-level add-in.

Remarks

The Resize property is intended to be used with the following parameters.

Parameter Description
RowSize The number of rows in the new range. If this argument is omitted, the number of rows in the range remains the same.
ColumnSize The number of columns in the new range. If this argument is omitted, the number of columns in the range remains the same.

If you attempt to use Resize without specifying any parameters, Resize will get a NamedRange_ResizeType object that is part of the Visual Studio infrastructure and is not intended to be used directly from your code.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to