Renaming Workbooks based on Cell Value with VBA

Jambi46n2

Board Regular
Joined
May 24, 2016
Messages
224
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,132
Office Version
365
Platform
Windows
How about
Code:
   Dim Fso As Object
   Set Fso = CreateObject("scripting.filesystemobject")
   Fso.CopyFile OldName1, NewName1
 
Last edited:

Jambi46n2

Board Regular
Joined
May 24, 2016
Messages
224
Thanks for the prompt response Fluff, you sir are a gentleman and a scholar!
 
Last edited:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,132
Office Version
365
Platform
Windows
What error number & message did you get?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,132
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,077,664
Messages
5,335,568
Members
399,025
Latest member
alce

Some videos you may like

This Week's Hot Topics

Top