+ Reply to Thread
Results 1 to 10 of 10

Amending various excel files including those in subfolders MACRO

  1. #1
    Registered User
    Join Date
    09-16-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Amending various excel files including those in subfolders MACRO

    Hi all

    I have approx 500 excel files that i need to make the exact same changes to. As an explanation and for arguments sake i have copied the 500 files from a 2012 directory to a new 2013 directory for this year and every file is for a member of staff. It is a fairly simple deleting data and a year change in several cells.

    Doing this manually will take days.

    I've put the following together with just a simple updating of 3 cells to say "I am amazing". However I need this to run on all subfolders. My 2013 directory is then split into teams which each member of staffs excel document in each of those folders. I dont want to have to rewrite the macro below for each subfolder.

    Any ideas how i can do this... and please keep it simple for me to follow as im not an excel whiz.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Amending various excel files including those in subfolders MACRO

    Try this:

    Please Login or Register  to view this content.
    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    09-16-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Amending various excel files including those in subfolders MACRO

    That is PERFECT!!

    Being cheeky now.. but i have a similar issue as i need to rename each file from 2012 to 2013. The file name is normally "BSC 2012 PersonsName"

    I have this which is exactly what i want but like the above it doesnt include subfolders. Could you amend to work like the above?

    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Amending various excel files including those in subfolders MACRO

    Put this line right after the line that closes the workbook.

    Please Login or Register  to view this content.
    The full code will look like this:

    Please Login or Register  to view this content.
    abousetta

  5. #5
    Registered User
    Join Date
    09-16-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Amending various excel files including those in subfolders MACRO

    Literally cant thank you enough for this! This has saved me probably a weeks worth of work!! Thank you thank you thank you.

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Amending various excel files including those in subfolders MACRO

    Glad I was able to help. I try to do good deeds whenever I can.

    abousetta

  7. #7
    Registered User
    Join Date
    09-16-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Amending various excel files including those in subfolders MACRO

    Oh last question. Not sure if its doable.

    Is there a way to get the path in the macro to pull from the spreadsheet im running the macro from?

    The code you have given above would need to be run every year, and i wouldnt want people playing with the code.

    So could i have in cell A1 for example : C:\Users\Raff\Desktop\Test\ - and that is inserted into the code you have written?

    Id want the same for old and new year..

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Amending various excel files including those in subfolders MACRO

    Yes, that's simple enough:

    Replace
    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    This will look for cell A1 in the first sheet in the workbook for the path to use.

    abousetta

  9. #9
    Registered User
    Join Date
    09-16-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Amending various excel files including those in subfolders MACRO

    Thanks again. I replicated that for the year too.

  10. #10
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Amending various excel files including those in subfolders MACRO

    Oh, sorry, didn't see the second part about for year. But you got the idea, you put the information in a cell, that information is converted into a variable and that variable is used instead of hard-coding the path or the date or whatever...

    Good luck.

    abousetta

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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