+ Reply to Thread
Results 1 to 8 of 8

Importing txt space delimited text file

  1. #1
    Registered User
    Join Date
    12-09-2013
    Location
    San Jose, CA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Importing txt space delimited text file

    Hi,
    I found this code that import TAB delimited text file. I would like to import space delimited text file instead. Please help me modify it.
    Thanks for your help.

    Please Login or Register  to view this content.
    Last edited by FDibbins; 01-15-2014 at 09:12 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Importing txt space delimited text file

    welcome to the forums,

    you should look at the forum rules about posting code before one of the moderators gets on your case

    If you look at the vba help for the split function you will see that the default delimiter is a space, so it looks like you only need to change the code to say

    Please Login or Register  to view this content.
    I havent tried the code you supplied but it seems you agree it works for tab delimited files

    Hope this helps and again, welcome to a forum where I am constantly amazed by how clever some solutions are and how much knowledge forum members are prepared to share

    Jmac

  3. #3
    Registered User
    Join Date
    12-09-2013
    Location
    San Jose, CA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Importing txt space delimited text file

    Hi,
    After change to
    Please Login or Register  to view this content.
    I got "subscript out of range" error and it highlights this line
    Please Login or Register  to view this content.
    Thanks for your help.
    Last edited by FDibbins; 01-15-2014 at 09:12 PM.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: Importing txt space delimited text file

    Hi and welcome to the forum

    jmac did try to advise you...

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I will add them for you - this time
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Importing txt space delimited text file

    huytran102,

    can you please send me a sample spreadsheet tht you are working with as well as an example of the space delimited file.

    I only need a couple of rows in the input data file to run the code through

    To attach files, click on the "Go Advanced" button, select add files and you should be OK from there

    jmac

  6. #6
    Registered User
    Join Date
    12-09-2013
    Location
    San Jose, CA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Importing txt space delimited text file

    Thanks for all the help so far. Attached is the space delimited text file I'm trying to import.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-09-2013
    Location
    San Jose, CA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Importing txt space delimited text file

    Thanks for the reminder. I'll definitely follow the forum rules next time.

    Quote Originally Posted by FDibbins View Post
    Hi and welcome to the forum

    jmac did try to advise you...

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.



    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I will add them for you - this time

  8. #8
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Importing txt space delimited text file

    Might suggest the OP reads about the cross posting rule as well: http://www.ozgrid.com/forum/showthread.php?t=185387

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Importing multiple Space delimited text files
    By rossw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2013, 08:56 AM
  2. Saving spreadsheet as space delimited text file
    By glanglois822 in forum Excel General
    Replies: 3
    Last Post: 01-13-2013, 09:11 PM
  3. Import space delimited text file into excel
    By vijay2482 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2009, 12:29 PM
  4. Opening a space delimited text file in Excel
    By c_mei83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2009, 02:00 AM
  5. Importing space delimited text file
    By EDIEC in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-23-2008, 03:44 PM

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