+ Reply to Thread
Results 1 to 9 of 9

Macro that changes a cell in each file within a folder

  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

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro that changes a cell in each file within a folder

    Do the workbooks have macros? Do they take a long time to calculate?
    Entia non sunt multiplicanda sine necessitate

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

    Re: Macro that changes a cell in each file within a folder

    None of the workbooks have their own macros. The only macro is in the Crew99999 file (one that was attached to this posing). I keep it in the same folder as the other (3,000) files and use it to run all of the other files in the folder. I don't know if this is the "right" way to do things, but I do not know any other way.

    -Peter

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro that changes a cell in each file within a folder

    Try this:
    Please Login or Register  to view this content.
    If that works, you can turn ScreenUpdating off during execution to speed things up.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro that changes a cell in each file within a folder

    I'm only guessing what you're attempting to do based on a step through of the macro in WB 01-01-01#Crew 9999.xls.
    It appears as if you're trying to copy the date from Cell F1 of WB 01-01-01#Crew 9999.xls (Week Ending: 2/18/2006) to WB 01-07-06#Crew 23.xls, WS Individuals Cell F1 and WS JobCosting Cell L1.

    If this is what you're attempting to do, try this code
    Please Login or Register  to view this content.
    If this is not what you're after, let me know. J
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

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

    Re: Macro that changes a cell in each file within a folder

    This worked. Thanks. I'm still new to VBA so I appreciate the help. It a whole new language, but one with tons of potential I am finding.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro that changes a cell in each file within a folder

    Hey Peter...I'm not certain what worked but that's not important. In your earlier post you indicated
    None of the workbooks have their own macros
    I noticed that WB 01-07-06#Crew 23.xls did indeed have a macro. It will probably never get called but it does increase file size. You may want to delete these "uncalled" procedures and their modules in workbooks that don't require them.
    J

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

    Re: Macro that changes a cell in each file within a folder

    Thanks for the tip. Indeed, I am just learning about macros and VBA so there are things like this that I don't think of.
    Cheers,
    Peter

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro that changes a cell in each file within a folder

    Still learnin' myself.
    J

+ 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