+ Reply to Thread
Results 1 to 5 of 5

Working code to import txt file to sheet.

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Working code to import txt file to sheet.

    Hi I have below code, which import a text file to sheet 2. The only problem I have with it is that the format is wrong. The date format in column C and E is not correct just a number for some of them and also column D payment nr, some are not displayed correct. I have put the input in below test sheet how it look, before I start correct it. And below is the code. I have attached the txt file to open with the macro. So all should be able to test. Please have a look thanks

    Sincerely
    ABjac



    The code.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Working code to import txt file to sheet.

    I do not think you need a code for this task. Excel text to column will do the job. I have recorded the macro and see the result in sheet3.
    Attached Files Attached Files

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Working code to import txt file to sheet.

    Hi abjac

    Try this Code
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Working code to import txt file to sheet.

    HI AB33 And Jaslake.Thanks allot for the help both. AB i tried your code but have problem make it work maybe because it dont comeup with a getopen filedialog. Your code Jaslake is just perfect. Tried it and it works like a charm.

    Thanks allot for the help.

    SIncerely

    Abjac

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Working code to import txt file to sheet.

    You're welcome...glad I could help. Thanks for the Rep.

+ 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. [SOLVED] Import module then run code not working.
    By R-Enemy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2015, 06:08 PM
  2. File import - select file and import sheet(1) from closed workbook
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2011, 03:15 AM
  3. VB code stopped working involving data import using XML
    By hariimmadi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2011, 06:04 PM
  4. VBA code to import text file to the fixed excel file
    By wangdian in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-30-2010, 10:13 AM
  5. Import VBA Code in Excel-File ? (Export VBA Code to file)
    By Matthias Pospiech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2005, 01:06 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