View Full Version : Macro to parse a file and input in a spreadsheet the lines that match parameters

08-26-2019, 04:30 PM
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!

08-26-2019, 05:24 PM
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

08-26-2019, 05:36 PM
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.