Worksheets are truncated into multiple Excel sheet by a column ID

Source: Internet
Author: User

You can do this by putting the following method in VBA

Note: A worksheet name of Sheet1 is required,

Objects used refer to: http://zhucongg.blog.163.com/blog/static/1148148320153742843347/

Sub s ()

application.screenupdating = False

Dim sh as Worksheet, I as Integer

For i = 2 to Sheet1. [a65536]. End (3). Row

If Sheet1.cells (i, 1) <> sheet1.cells (i-1, 1) Then

Worksheets.add After:=worksheets (Sheets.count)

Set sh = ActiveSheet

Sh. Name = Sheet1.cells (i, 1)

Sh. Range ("A1"). Resize (1, 3). Value = Sheet1.range ("A1"). Resize (1, 3). Value

Sh. Range ("a65536"). End (3). Offset (1, 0). Resize (1, 3). Value = Sheet1.cells (i, 1). Resize (1, 3). Value

Else

Sh. Range ("a65536"). End (3). Offset (1, 0). Resize (1, 3). Value = Sheet1.cells (i, 1). Resize (1, 3). Value

End If

Next I

application.screenupdating = True

End Sub

Worksheets are truncated into multiple Excel sheet by a column ID

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.