Copy worksheet as a new workbook.

GedSalter

Board Regular
Joined
Apr 24, 2019
Messages
80
I would like to be able to copy a certain worksheet as a new stand alone workbook. The new workbook name should be the number that will be in cell M4 on that particular worksheet.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
How about
Code:
Sub GedSalter()
   ActiveSheet.Copy
   ActiveWorkbook.SaveAs ThisWorkbook.path & "\" & Range("M4").Value & ".xlsx", 51
End Sub
 
Upvote 0
Hi Fluff, many thanks for that but I forgot that the file needs to go into another folder called ARCHIVE and it needs to be macro enabled file. When I change the file extention to Xlsm it doesn't like it.
 
Upvote 0
In that case try
Code:
ActiveWorkbook.SaveAs "[COLOR=#ff0000]your path here[/COLOR]\" & Range("M4").Value & ".[COLOR=#ff0000]xlsm[/COLOR]", [COLOR=#ff0000]52[/COLOR]
 
Upvote 0
the path bit is not working for me. The destination folder is on my desktop C:\Desktop\GHR\Quotes\Archives but it doesnt recognise it.
 
Upvote 0
Try
Code:
ActiveWorkbook.SaveAs Environ("userprofile") & "\Desktop\GHR\Quotes\Archives\" & Range("M4").Value & ".xlsm", 52
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,796
Members
449,095
Latest member
m_smith_solihull

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