+ Reply to Thread
Results 1 to 10 of 10

Button To Rename Current File According to information Entered in Cell

  1. #1
    Registered User
    Join Date
    08-27-2018
    Location
    London
    MS-Off Ver
    office 2016
    Posts
    45

    Button To Rename Current File According to information Entered in Cell

    Hello

    Looking for code to rename current file according to new information entered in specific cell

    say the file AccountsP9W1.xlsm has new information entered in the tab called SETUP under D8 and D9 . New entries D8 =10 and D8=2

    When the button is clicked to run the code, it renames the file to AccountsP10W2.Xlsm

    I figure that it is not possible to rename an open file, would the code close and then reopen the file with the new name?

    Ideally the button would be in the SETUP tab as well

    Thanks
    Attached Files Attached Files
    Last edited by diddy47; 09-24-2019 at 01:16 PM.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Button To Rename Current File According to information Entered in Cell

    Perhaps...
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Button To Rename Current File According to information Entered in Cell

    @sintek,

    Goeie naand my vriend,

    Good solution indeed, but why the "Kill path & "\" & "AccountsP1W1.xlsm""?
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Button To Rename Current File According to information Entered in Cell

    @ Winon
    lol My koppie raas...

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Button To Rename Current File According to information Entered in Cell

    @ sintek,

    LOL. Moet ek jou hare aan die brand steek sodat jy jouself kan doodklap?

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Button To Rename Current File According to information Entered in Cell

    @ Winon
    Yep, need a wake up call every now and then...
    @diddy47
    So as Winon raised...Leave out this part...
    Please Login or Register  to view this content.
    Got confused with actual file name and your mention...
    AccountsP9W1.xlsm

  7. #7
    Registered User
    Join Date
    08-27-2018
    Location
    London
    MS-Off Ver
    office 2016
    Posts
    45

    Re: Button To Rename Current File According to information Entered in Cell

    Hello, thanks for your response and the code,

    it works to create the new file however the old file still exists
    e.g if the file is AccountsP8W2, the new value enetred as 10 and 4, the new file AccountsP10W4 is created but the old file also still exists

    This is after removing the last line of code as you instructed

    Is there a way to make the initial file delete when the new one is created

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Button To Rename Current File According to information Entered in Cell

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-27-2018
    Location
    London
    MS-Off Ver
    office 2016
    Posts
    45

    Re: Button To Rename Current File According to information Entered in Cell

    that worked very well, thank you

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Button To Rename Current File According to information Entered in Cell

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks.gif

+ 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. Macro to rename current file to include folder name
    By sspatriots in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2017, 07:13 PM
  2. Macro: For Having Current date entered cell in all sheets
    By bamaisgreat in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-15-2014, 05:16 PM
  3. Rename Excel files on base of current file name
    By ali84pk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2010, 08:46 AM
  4. Struggling with macro to rename file using current date
    By ST4RCUTTER in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2007, 01:13 PM
  5. [SOLVED] Rename active sheet with current file name
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-11-2006, 01:35 PM
  6. rename current file save and delete original
    By valve79 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2006, 05:17 PM
  7. Rename file based on current date
    By wira in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2005, 06:06 AM

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