Range.resize Properties of VBA Learning notes

Source: Internet
Author: User

' 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.