Results 1 to 7 of 7

Thread: Renaming Workbooks based on Cell Value with VBA

  1. #1
    Board Regular Jambi46n2's Avatar
    Join Date
    May 2016
    Location
    USA
    Posts
    224
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Renaming Workbooks based on Cell Value with VBA

    The code below works with renaming workbooks, however it also moves them as well.

    Is there a way to modify the code to make a copy of the workbook instead of moving it?

    Thanks much in advance!

    Code:
    Sub RenameTesting()
    
    
    Dim OldName1, NewName1
    
    'Work books based on cell values below
    OldName1 = [F10]: NewName1 = [C10]
    
    'Renames workbooks and moves workbooks
    Name OldName1 As NewName1
    
    End Sub
    Using Microsoft Office 365 ProPlus on Windows 10

  2. #2
    Board Regular Jambi46n2's Avatar
    Join Date
    May 2016
    Location
    USA
    Posts
    224
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Renaming Workbooks based on Cell Value with VBA

    Screen shot of what I'm going for...

    https://ibb.co/F681DvQ
    Last edited by Jambi46n2; Aug 9th, 2019 at 02:21 PM.
    Using Microsoft Office 365 ProPlus on Windows 10

  3. #3
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    29,067
    Post Thanks / Like
    Mentioned
    483 Post(s)
    Tagged
    48 Thread(s)

    Default Re: Renaming Workbooks based on Cell Value with VBA

    How about
    Code:
       Dim Fso As Object
       Set Fso = CreateObject("scripting.filesystemobject")
       Fso.CopyFile OldName1, NewName1
    Last edited by Fluff; Aug 9th, 2019 at 02:26 PM.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  4. #4
    Board Regular Jambi46n2's Avatar
    Join Date
    May 2016
    Location
    USA
    Posts
    224
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Renaming Workbooks based on Cell Value with VBA

    Thanks for the prompt response Fluff, you sir are a gentleman and a scholar!
    Last edited by Jambi46n2; Aug 9th, 2019 at 02:40 PM.
    Using Microsoft Office 365 ProPlus on Windows 10

  5. #5
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    29,067
    Post Thanks / Like
    Mentioned
    483 Post(s)
    Tagged
    48 Thread(s)

    Default Re: Renaming Workbooks based on Cell Value with VBA

    What error number & message did you get?
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  6. #6
    Board Regular Jambi46n2's Avatar
    Join Date
    May 2016
    Location
    USA
    Posts
    224
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Renaming Workbooks based on Cell Value with VBA

    Quote Originally Posted by Fluff View Post
    What error number & message did you get?
    The error message was human error on my part.

    Can't thank you enough again.

    I sincerely appreciate it.
    Last edited by Jambi46n2; Aug 9th, 2019 at 04:38 PM.
    Using Microsoft Office 365 ProPlus on Windows 10

  7. #7
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    29,067
    Post Thanks / Like
    Mentioned
    483 Post(s)
    Tagged
    48 Thread(s)

    Default Re: Renaming Workbooks based on Cell Value with VBA

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •