Consulting

Results 1 to 3 of 3

Thread: Macro to parse a file and input in a spreadsheet the lines that match parameters

  1. #1

    Macro to parse a file and input in a spreadsheet the lines that match parameters

    So I am fairly new to VBA and I've been asked to write a script to access a file named 2811_***_**** where the 2811 stays the same everyday but the end changes. I then need to parse each line and if it meets a certain parameter that I have been given, then it needs to list each carton in a cell on a spreadsheet. I've linked a screenshot in the post. So for example, when the script reads a line and the carton starts with 0606 like the one in the screenshot, then it needs to grab the whole carton number and input into a cell and has to do that for every carton it finds that starts with 0606. Any help is greatly appreciated, thank you!
    Attached Images Attached Images
    Last edited by TeeJBeams; 08-26-2019 at 05:33 PM.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Welcome to the forum. Take a minute and read the FAQs in the link in my sig

    Just a screenshot is not very helpful

    It's better if you attach a file or workbook that shows the inputs and what you want for an output

    So if that is a TXT file (kinda looks like one) then attach it. There's no headers so a 'carton it finds that starts with' requires an assumption that the Carton field is the fourth one

    There's a lot of cells on a spreadsheet so 'input into a cell' is a little too broad

    Attach a workbook that shows what you're looking for after the user selects '0606' as the carton start
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Appreciate the reply Paul, so I added another screenshot of the exact email. It will give a little more clarity on what needs to be done, I think I can do it I just need a little help getting started. The flagged cartons can be put into any cell it doesn't matter, instead of him going to find each carton that matches he just wants to have a script to click a button then goes through the report and lists in a spreadsheet which cartons met those parameters in the new screenshot.

Tags for this Thread

Posting Permissions

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