Results 1 to 5 of 5

IMPORTING TEXT FILES TO EXCEL - Multiple Multi-line text files, each in a new column

Threaded View

wrenchfry IMPORTING TEXT FILES TO EXCEL... 12-23-2014, 05:28 PM
pjwhitfield Re: IMPORTING TEXT FILES TO... 12-23-2014, 07:59 PM
gmr4evr1 Re: IMPORTING TEXT FILES TO... 12-23-2014, 08:03 PM
jindon Re: IMPORTING TEXT FILES TO... 12-23-2014, 08:24 PM
wrenchfry Re: IMPORTING TEXT FILES TO... 12-23-2014, 08:37 PM
  1. #1
    Registered User
    Join Date
    12-23-2014
    Location
    LA CA
    MS-Off Ver
    2010
    Posts
    2

    Question IMPORTING TEXT FILES TO EXCEL - Multiple Multi-line text files, each in a new column

    Hello all,

    I have multiple multi-line text files that I am trying to import into one sheet. I would like each text file to have its own column.

    Thus far, I have successfully pulled them all in to one column using the code that user patel45 posted here:

    Sub readTxtFiles()
    Dim folderPath As String, Filename As String, WB As Workbook
    folderPath = "C:\test\" ' <<<< folder of text files (to be changed)
    Filename = Dir(folderPath & "*.txt")
    drow = 2 ' <<< initial destination row
    Do While Filename <> ""
        sn = Split(CreateObject("scripting.filesystemobject").opentextfile(folderPath & Filename).readall, vbCrLf)
        For j = 0 To UBound(sn)
           Cells(j + drow, 1) = sn(j)
        Next
        drow = drow + j
        Filename = Dir
    Loop
    
    End Sub
    Would anyone be able to help me figure out what to add to this code to make each text file have its own column?

    Thank you in advance! (And thank you to patel45 for at least getting me started in the right direction.)
    Last edited by wrenchfry; 12-23-2014 at 05:49 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. IMPORTING TEXT FILES TO EXCELL - Multiple Multi line text files
    By Toxicca in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-12-2014, 09:56 AM
  2. [SOLVED] Last line of multiple text files matching first column numbers only
    By c_schoonraad in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2012, 03:07 PM
  3. importing multiple text files into one worksheet and one column
    By hluk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-16-2010, 10:03 PM
  4. Importing multiple text files.
    By Jdrewrd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2008, 07:49 AM
  5. Importing from multiple text files
    By tmort in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2005, 09:50 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1