Results 1 to 4 of 4

Looping through a Copy & Paste

Threaded View

  1. #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?

    Sub JPSIMMON()
    Dim wbk As Workbook, Source As String, StrFile As String
    Source = "K:\DRIVE\FOLDERPATH\FOLDER\"
    StrFile = Dir(Source)
       Do While Len(StrFile) > 0
            Workbooks.Open filename:=Source & StrFile
            StrFile = Dir()
        Loop
    For Each wbk In Workbooks
        If wbk.Name <> Thisworkbook.Name And wbk.Name <> "PERSONAL.xlsm" Then
            Thisworkbook.Sheets("Sheet1").Columns("J:K").Copy
            wbk.Sheets("Atts").Range("A1").PasteSpecial xlPasteValues
        End If
        wbk.Save
        wbk.Close
    Next wbk
    End Sub
    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.

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