Results 1 to 3 of 3

use file list to open files to copy cells over

Threaded View

  1. #1
    Registered User
    Join Date
    12-21-2011
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    30

    use file list to open files to copy cells over

    hi guys, I have another question.

    I have a macro that I am writing. What it does so far is that it lists the file path of a working folder that the user determines. What I need it to do is open each file, copy A2 and the last cell is column A and past A2 is the active G2 column and the last file in H2. Then I need it to move to the next file and do it again but this time move down to G3 and H3, still it finishes all of the files in folder. I will attach a .xls as an example and also here is my code;

    Sub Macro1()
    'Get inputs
    Sheets("Input").Select
    WorkingFolderName = Range("B1").Value
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set WorkingFolder = fso.GetFolder(WorkingFolderName)
    
    Sheets("Input").Select
    WorkingFolderName = Range("B1").Value
    ListRow = 2 'List all files in the working folder
    For Each CurrentFile In WorkingFolder.Files 'scan all the files in the folder
        Worksheets("File list").Range("A" & ListRow).Value = CurrentFile.Path 'file path
        ListRow = ListRow + 1
    Next CurrentFile
    Sheets("File list").Select
    End Sub
    Attached Files Attached Files
    Last edited by chi11; 01-09-2012 at 12:25 PM.

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