+ Reply to Thread
Results 1 to 4 of 4

Reading a text file and extracting information

  1. #1
    Registered User
    Join Date
    04-24-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2

    Reading a text file and extracting information

    **I apologize for the bad thread title. I accidentally submitted while writing it. Thread should read Reading a text file and extracting information

    So I have a small project that I've concluded that the simplest way would be to use an Excel VBA macro but my knowledge on this is limited and I would appreciate some help on this. I have a text file that contains a lot of information but I specifically need only small portions of it, which must be placed in an Excel spreadsheet. To paint a better picture, think of multiple paragraphs containing information but the information I need is only contained in paragraphs that start with the letter "B" and followed by a number. So if the paragraph starts with "B39", this is a paragraph I need to pull information from. Thank fully, a portion of the information is properly labeled. So for example, if I need the "Manuf", that appears as "Manuf: XXX" within the text file.

    So here's my idea for this. To create a macro that names each cell column appropriately, such as a cell column named "Manuf", then the macro opens the text file by reading the file path, then begins to crawl it until it hits a B+integer, there it begins looking for other data need data such as "weight", "color", etc. Once it hits the last needed data for that paragraph, it looks for B+integer again until it goes through the whole text file.

    Is this possible and does anyone have any advice on the steps I can take?
    Thanks
    Last edited by FDibbins; 04-24-2015 at 06:05 PM. Reason: Explanation

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,552

    Re: Reading a text file and extracting information

    If you upload a small sample source Text file and the workbook with your desired result from the source text file, it would help us to understand what you are trying to do.

  3. #3
    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,942

    Re: Reading a text file and extracting information

    Hi, welcome to the forum

    I changed your title for you (thanks for including what you meant it to be)...for future reference, to change a Title on your post, click EDIT POST then Go Advanced and change your title.

    I think this would be easier to work on if you could upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    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

  4. #4
    Registered User
    Join Date
    04-24-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2

    Re: Reading a text file and extracting information

    Thanks FDibbins for fixing the thread title for me. I've uploaded a sample text and a sample book like you and jindon have asked. I've been doing some research on this but outside of getting the top cells renamed, I keep hitting a wall. Especially on the portion on telling the macro to keep executing until it reaches the end of the file to search for other products that start with B+8 digits. Any advice pointing me in the right direction would be greatly appreciated.
    Attached Files Attached Files

+ 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] ReadIn picture and name of picture
    By bluesurger in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-03-2014, 08:26 AM
  2. Problems with Copy and readIn from a with protect
    By bluesurger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-27-2014, 03:28 AM
  3. readin / altering values on checkboxes on another sheet
    By philbennison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-14-2009, 08:35 AM
  4. Strange!: Advanced Filter effects readin backcolor of cell
    By merkurgezegeni in forum Excel General
    Replies: 0
    Last Post: 03-30-2009, 10:25 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