+ Reply to Thread
Results 1 to 4 of 4

Looping through a Copy & Paste

  1. #1
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Looping through a Copy & Paste

    I have a piece of code that opens a separate Workbook, copy and pastes a few columns, saves and closes the separate workbook: (YYZ.xlsm). I have about 30 other Workbooks in a folder I want to do this to. How can I change this to just open a folder and do the copy and paste function to all workbooks in the folder? Just loop through a folder of workbooks: YYZ, YYX, YYA etc... performing the same function.

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Looping through a Copy & Paste

    See if this link helps out at all...or gets you in the right direction..
    http://www.ozgrid.com/VBA/2007-files...lternative.htm
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Re: Looping through a Copy & Paste

    Thanks 4evr, still having trouble incorporating the loop into my code though.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Looping through a Copy & Paste

    Does this help?

    Please Login or Register  to view this content.
    I'm not sure about what you're trying to achieve. This will open all workbooks in a folder. Copy Columns("J:K") to Sheet("Atts") - Each workbook in the folder needs to have this sheet. Save and Close each workbook with the changes. Anyway it might give you some ideas. Note: All other workbooks need to be closed except for those associated with the macro.
    Last edited by JOHN H. DAVIS; 01-28-2016 at 03:34 PM.

+ 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] Copy 2 cells and paste - looping
    By Netaji in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-29-2014, 01:27 PM
  2. Folder Copy/Paste Looping
    By gibsonj4 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2014, 02:41 PM
  3. VBA Looping for copy paste after running analysis
    By finansator in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-14-2014, 09:58 PM
  4. [SOLVED] Help with Looping a copy and paste marco
    By Robert110 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-26-2013, 11:02 AM
  5. [SOLVED] VBA Looping Copy and Paste
    By harrison298 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2012, 11:43 AM
  6. Looping Copy/Paste Macro
    By yuuuh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-22-2010, 11:56 PM
  7. Looping and copy/paste specific rows
    By Desi_bhai in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2007, 12:50 PM

Tags for this Thread

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