+ Reply to Thread
Results 1 to 6 of 6

How to rename file according to vlookup value?

  1. #1
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    How to rename file according to vlookup value?

    The cells A1 to B5 in excel are :

    AAA 1
    BBB 2
    EEE 5
    DDD 4
    CCC 3

    How to rename the following email files in C:\
    AAA
    CCC
    EEE

    as follows:
    1
    3
    5

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: How to rename file according to vlookup value?

    Try this.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to rename file according to vlookup value?

    It is regret that the VBA not work.

    Please note that the following not work in my excel:
    OldName = "C:\Users\DK-01\Desktop\Renaming\CCC"
    NewName = "C:\Users\DK-01\Desktop\Renaming\1"

    Name OldName As NewName

    but the following VBA is OK:


    OldName = "C:\Users\DK-01\Desktop\Renaming\CCC.msg"
    NewName = "C:\Users\DK-01\Desktop\Renaming\1.msg"

    Name OldName As NewName

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: How to rename file according to vlookup value?

    You didn't mention any extension in your first post (and I don't have a cristal ball), but it's pretty obvious that that's a part of the filename".

  5. #5
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to rename file according to vlookup value?

    Thanks bakerman2.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: How to rename file according to vlookup value?

    You're welcome and thanks for rep+.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. My File Rename Macro Always Doesn't Rename the Last Three files in the list
    By Enright in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2016, 03:46 PM
  2. Replies: 0
    Last Post: 01-21-2014, 10:52 AM
  3. Excel VBA find and replace string in non text file and rename file
    By razzack in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2013, 02:43 PM
  4. Replies: 1
    Last Post: 04-20-2013, 10:30 AM
  5. [SOLVED] import every file in the folder and rename sheet to the imported file name
    By vivek_work in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-04-2012, 02:46 PM
  6. File Saved As Read Only? Can't Delete / Rename File
    By Kolin in forum Excel General
    Replies: 3
    Last Post: 11-02-2010, 12:01 PM
  7. Rename Multiple Excel Sheets Using Master Vlookup Sheet File
    By avantgti7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-13-2010, 10:58 AM

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