Loop Code - Exporting to Template Workbook

  • Hello all,

    After much experimentation I've managed to get some loop code working to speed up a project I have.Currently, the code looks through a long worksheet to find a specific name in a column, then, copies the entire row to another worksheet which matches the name required. Then, it saves a copy of that worksheet to a workbook on my desktop.

    I was wondering if there was a way to get this information copied in to a template workbook, save that with a specific name, then move on to the next name in the list and repeat the process. Open a template work book containing three worksheets, loop through main workbook to find name X, copy all rows where X exists and copy in to sheet 1 of the template workbook, save as name X, then move on to the next one until complete.

    Please see below some code I'm using to do this, as I don't know how to export to an existing workbook, I've had to add in extra bits to format the results (remove blank rows), edit the header row, then save each worksheet to a seperate workbook.

    Apologies if the above is a bit too vague, but I was wondering if there was a way to do what I would like. It's no huge issue if not, it will just stop and awful lot of copy pasting.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!