+ Reply to Thread
Results 1 to 3 of 3

Replacing specific characters of a filename every month. Please Help!!

  1. #1
    Registered User
    Join Date
    08-05-2005
    Location
    Bangalore
    Posts
    14

    Replacing specific characters of a filename every month. Please Help!!

    Hi

    I have 10 & ”xls” files saved in 1 folder and 5 sub-folders, which
    have filenames suffixed with common characters. I replace these characters
    month-on-month.

    Can anyone please help me by writing a macro for replacing these characters of a filename?

    For, e.g,

    Folder > sub folder > report name

    1. 2011 > Revenue Reports > report name_1 Aug-11.xls
    2. 2011 > Revenue Reports > report name_2 Aug-11.xls
    3. 2011 > Marketing Reports > report name_3 Aug-11.xls
    4. 2011 > Marketing Reports > report name_4 Aug-11.xls
    5. 2011 > Expenses Reports > report name_5 Aug-11.xls
    6. 2011 > Expenses Reports > report name_6 Aug-11.xls
    7. 2011 > Sales Reports > report name_7 Aug-11.xls
    8. 2011 > Sales Reports > report name_8 Aug-11.xls
    9. 2011 > Billings Reports > report name_9 Aug-11.xls
    10. 2011 > Billings Reports > report name_10 Aug-11.xls

    As I have explained at the top, I’ll have to monthly change the month name manually (in above e.g., from "Aug" to "Sep"); which i wish could be automated using macros.

    Can we have a command included in this macro that searches for "xls" files at the main folder level i.e., "2011" folder and this search will consider all the 10 files that are in different sub-folders inside the main folder "2011".

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Replacing specific characters of a filename every month. Please Help!!

    hi, rahulmamtora, please check attachment, run code "test"
    Attached Files Attached Files
    Last edited by watersev; 08-27-2011 at 06:09 PM.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Replacing specific characters of a filename every month. Please Help!!

    Hello rahulmamtora,

    Welcome to the Forum!

    Here is another method using only VBA and no additional scripting libraries. This will work will all versions of VBA. You will need to change the path to the parent folder (2011) before running the macro. It is marked in bold text below. Copy and paste the code below into a new VBA module in your workbook.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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