+ Reply to Thread
Results 1 to 4 of 4

Rename Excel files based on cell contents

  1. #1
    Registered User
    Join Date
    08-28-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Rename Excel files based on cell contents

    Hi there,

    a friend of mine recently experienced a harddrive failure containing al of his invoices made with Excel from the past 4 years. While the contents of most files could be salvaged, the filenames could not be recovered. He now has hundreds of Excel files with names containing random letters and numbers.

    Is there a way of using a macro to loop through all of his Excel files in a folder, retrieve the date (which is in the same cell on all the worksheets) and rename the Excel files accordingly?

    Much thanks in advance!

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Rename Excel files based on cell contents

    remco_t,

    Welcome to the forum!
    Give this a try:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    08-28-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Rename Excel files based on cell contents

    Cheers tigeravatar!

    I've just tested that script and it seems to work like a charm. But let's say I wanted to add a client name (which would be on the same sheet in a different cell) in the filename i.e. [clientname]_[date].xls?

    Sorry I forgot to mention this in my initial post...

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Rename Excel files based on cell contents

    Updated code:
    Please Login or Register  to view this content.

+ 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