+ Reply to Thread
Results 1 to 6 of 6

Finding Dates in Text Files and pasting into spreadsheet

  1. #1
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Finding Dates in Text Files and pasting into spreadsheet

    Hello,

    I have a folder with txt files. Each txt file can be opened in excel as a tab delimited file. Each text file has a line that says load date, and the date.

    For instance like this: LOAD-DATE: April 23, 2010

    Through Excel, I would like to create a macros that can create a worksheet that has the name of all the txt files in Column B and the respective Load Date pulled from the txt file in column C.

    I have attached a sample workbook and two sample txt files.
    Attached Files Attached Files
    Last edited by undergraduate; 05-02-2010 at 05:08 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Finding Dates in Text Files and pasting into spreadsheet

    Try This Example, Be sure to change the Directory in the code.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: Finding Dates in Text Files and pasting into spreadsheet

    It works great with your macros, however I get a type mismatch '13 error with a few of the text files, any idea why? I have attached one of the files it stops at
    Attached Files Attached Files
    Last edited by undergraduate; 05-02-2010 at 08:38 PM.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Finding Dates in Text Files and pasting into spreadsheet

    It showed the error as you said, when I added an error handling, the error did not show up and the code seemed to work as normal

    Please Login or Register  to view this content.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Finding Dates in Text Files and pasting into spreadsheet

    Try this, I used Dave's Workbook.OpenText approach but the rest is a little shorter:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  6. #6
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: Finding Dates in Text Files and pasting into spreadsheet

    thank you both very much you have both been very helpful

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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