Results 1 to 2 of 2

Thread: Copy the one column range from excel to notepad

  1. #1

    Copy the one column range from excel to notepad



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hello,

    Is there a way to copy from excel to a notepad file.

    1 The macro would run from sheet1.
    2 Create folder on desktop. If folder exists do not create.
    3 Create notepad file name mentioned in sheet2 A1. Copy content of sheet2 range B2:B2500, to this file. If this text file exists overwrite the file, without any prompt.

    Please help with simplest way to achieve.

    Thanks in advance.

  2. #2
    Acolyte patel's Avatar
    Join Date
    Feb 2014
    Location
    Italy
    Posts
    59
    Articles
    0
    Code:
    Sub ColumnToTxt()
        Dim x As String
        x = Sheet2.Range("B2:B2500").Address
        fname = Sheet2.Range("A1")
        Open "C:\users\yourname\desktop\" & fname For Output As #1
        Print #1, Join(Evaluate("transpose(" & x & ")"), vbCrLf)
        Close #1
    End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •