Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (40 sloc) 1.6 KB
title keywords f1_keywords ms.prod api_name ms.assetid ms.date localization_priority
Range.Resize property (Excel)
vbaxl10.chm144187
vbaxl10.chm144187
excel
Excel.Range.Resize
05af0539-8aa3-c83c-1972-dfac618929b9
05/11/2019
Normal

Range.Resize property (Excel)

Resizes the specified range. Returns a Range object that represents the resized range.

Syntax

expression.Resize (RowSize, ColumnSize)

expression An expression that returns a Range object.

Parameters

Name Required/Optional Data type Description
RowSize Optional Variant The number of rows in the new range. If this argument is omitted, the number of rows in the range remains the same.
ColumnSize Optional Variant The number of columns in the new range. If this argument is omitted, the number of columns in the range remains the same.

Return value

Range

Example

This example resizes the selection on Sheet1 to extend it by one row and one column.

Worksheets("Sheet1").Activate 
numRows = Selection.Rows.Count 
numColumns = Selection.Columns.Count 
Selection.Resize(numRows + 1, numColumns + 1).Select

This example assumes that you have a table on Sheet1 that has a header row. The example selects the table without selecting the header row. The active cell must be somewhere in the table before you run the example.

Set tbl = ActiveCell.CurrentRegion 
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _ 
 tbl.Columns.Count).Select

[!includeSupport and feedback]

You can’t perform that action at this time.