' Range.resize Property
' Adjusts the size of the specified area. returns a Range object that represents the adjusted area.
' Grammar
' expression. Resize (number of rows, columns)
' expression An expression that returns a Range object.
1 Sub Test () 2 [A1]. Resize (23). Select3 [A1]. Resize (2). Select43). Select5End Sub
Note: Resize is the range itself starting from "1", [A1].resize ();
But offset is the range itself starting from "0", [A1].offset (0,0);
Both lines of code return to the A1 area.
Précis-writers: Resize includes the original area for expansion; offset does not include the original region
1 Sub Save ()' copy part of the data in the Sheet1 to Sheet22Dim i%, j%, k%3 14 j = [A1]. CurrentRegion.Columns.Count5 k = Application.counta (Sheet2.columns (1))' call a worksheet function to calculate the number of non-empty rows in the first column of Sheet2 so that the data does not overlap after the offset 6 [A2]. Resize (i, J). Copy Sheet2. [A1]. Offset (k)7End Sub
Note: The meaning of K here is that data does not overlap when you run the secondary process repeatedly
:
Range.resize Properties of VBA Learning notes