Results 1 to 9 of 9

Macro that changes a cell in each file within a folder

Threaded View

  1. #1
    Registered User
    Join Date
    09-26-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Macro that changes a cell in each file within a folder

    Hello,
    I'm having a bugger of a time with my macro (pasted below). The macro is supposed to be written to make changes in each excel file within a folder. Specifically I want to copy paste a value from one worksheet to another (in the same file) and then save and close. The idea is to repeat this for all of the 3,000 files in the folder.

    When I run the macro, the hour glass starts to work and after about 20 seconds or so it stops and no changes were made. I am attaching the file that has the macro in it, as well as one of the 3,000 files that I am trying to change.

    Any help would be appreciated.
    Thanks from Seattle,
    Peter

    Sub ProAddJobCostingDate()
    With Application.FileSearch
    .LookIn = "F:\Excel"
    .Filename = "*.xls"
    .FileType = msoFileTypeExcelWorkbooks
    If .Execute() > 0 Then
    
    Set newwkbk = ActiveWorkbook
    
    For i = 1 To .FoundFiles.Count
    Set wkbk = Workbooks.Open(.FoundFiles(i))
    Call Sheets("Individuals").Select
        Range("f1").Select
        Selection.Copy
        Sheets("JobCosting").Select
        Range("l1").Select
        ActiveSheet.Paste
        ActiveWorkbook.save
        ActiveWorkbook.Close
    
    Next i
    End If
    End With
    End Sub
    Attached Files Attached Files

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