+ Reply to Thread
Results 1 to 5 of 5

Macro to choose folder and cycle through all files

Hybrid View

  1. #1
    Registered User
    Join Date
    06-20-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Macro to choose folder and cycle through all files

    Thank you I'll go see if this works for me!!!

    Also to explain the 'paste' sheet:

    I already have a workbook that has a bunch of macros activated anytime the paste sheet is changed. So really that moves all the data into other tabs.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro to choose folder and cycle through all files

    Sub Runfolder()
      with Application
        .ScreenUpdating = False
        .EnableEvents = False
    
        c00 = .GetOpenFilename("*.xls, *.xls")
     
        for each fl in CreateObject("Scripting.FileSystemObject").getfolder(Replace(c00, Dir(c00), "")).files
          if instr(right(fl.name,4),"xls")>0 then
            with getobject(fl)
              .sheets("summary").usedrange.copy  Workbooks(("Stats2011.xlsm").Sheets("Paste").cells(1)      
              .close false
            End With
          end if
        next
    
        .EnableEvents = true
      end with
    End Sub
    Last edited by snb; 06-22-2011 at 03:53 PM.



+ 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