How to store each row in Excel as a TXT document

Source: Internet
Author: User

When there are multiple rows of data in Excel, we also need to store each row of data into a TXT document, do we need to manually Ctrl + c --> Ctrl + V --> Ctrl + S? The answer is no doubt. Wow, I need to process a document that stores more than 60 thousand pieces of data. In order to cherish my life, I will use VBA in the office to speculate!

Use the shortcut key Alt + F11 to open the Excel VBA and enter the following code:

Private Sub CommandButton1_Click()    Application.ScreenUpdating = False    Dim nRow As Long    nRow = Range("a65536").End(xlUp).Row    For i = 1 To nRow        Open ThisWorkbook.Path & "\文件" & i & ".txt" For Output As #1        Print #1, Range("a" & i)        Close #1    Next    Application.ScreenUpdating = True    MsgBox "ok"End Sub

Click Run.

However, when the main user sees that when I disable VBA, the special functions of this document cannot be seen, and a button control is added to excel. In the development tool, click the control, click the button, double-click the button, and enter the above Code.

How to store each row in Excel as a TXT document

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.