Need VBA Code To Save File As To New Location With New Name

excelbytes

Active Member
Joined
Dec 11, 2014
Messages
291
Office Version
  1. 365
Platform
  1. Windows
I have a file template that I use to enter data into. Afterwards I need to save it with a new name based on the text in a specific cell and to another file location. I have two pieces of code:

VBA Code:
Dim name As String
name = Worksheets("OFFICIAL DRAFT").Range("I2").value
ActiveWorkbook.SaveAs Filename:=name

ActiveWorkbook.SaveAs Filename:= "N:\Parts Technical\Mark\MPA New Part Adds\......"

I need to combine these two so that the file is saved to the "N" location based on the name in cell I2 of the OFFICIAL DRAFT worksheet.

Thanks in advance for your help!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Assuming the full path name for the destination folder is shown above:

VBA Code:
Dim name As String
name = Worksheets("OFFICIAL DRAFT").Range("I2").value
ActiveWorkbook.SaveAs Filename:= "N:\Parts Technical\Mark\MPA New Part Adds\" & name
Note that a SaveAs will mean that the currently open file is now the new copy of the file in the new location. You are no longer editing the original file at this point.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,886
Messages
6,175,195
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top