+ Reply to Thread
Results 1 to 6 of 6

Macro to copy a selection, paste it in a new workbook then loop

  1. #1
    Registered User
    Join Date
    03-17-2008
    Posts
    85

    Macro to copy a selection, paste it in a new workbook then loop

    EXAMPLE.xls

    Hello

    I have a list of data that I have to send out each quarter to a load of suppliers. The list is about 9 columns long and all the suppliers are in supplier number order. (there can be between 3,000 and 30,000 rows of data)

    Usually after sorting the list by supplier (there are max 150 suppliers) I have to manually copy down the data for the first supplier, open a new workbook, paste the data, go back to the 1st (master) sheet, delete the data I just copied and repeat. (each time copying the header row across with the data) When I have a workbook for each supplier I then copy the supplier name from one of the columns and save each one down before sending them out.

    Is there any way I can write (or someone can write for me) a macro that copies the data, pastes it into a new workbook then looks for the next supplier and does the same and so on ?

    If there is a better way of doing this then please let me know

    Any help or suggestions would be much appreciated

    Please let me know if you need more info or if any of this does not make sense

    Thanks very much !!
    Last edited by AK262007; 07-06-2010 at 06:36 AM. Reason: Example Added

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro to copy a selection, paste it in a new workbook then loop

    Probably, but I suggest you attach a sample workbook.

  3. #3
    Registered User
    Join Date
    03-17-2008
    Posts
    85

    Re: Macro to copy a selection, paste it in a new workbook then loop

    Have now added example

    Thanks

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro to copy a selection, paste it in a new workbook then loop

    I think this does what you want. It copies each supplier to a different workbook and saves in the C drive:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-17-2008
    Posts
    85

    Re: Macro to copy a selection, paste it in a new workbook then loop

    Thats brilliant - thanks so much

    Really sorry to add this now but is there any way that it can save the sheet as whatever is in column 2 as this will contain the supplier name

    Also if it could save it in folder in the c drive called "draft statements" that would be brilliant

    Thanks again

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro to copy a selection, paste it in a new workbook then loop

    Try this. You can change save location to anything.
    Please Login or Register  to view this content.

+ 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