Save only Worksheets and Values of Macro Workbook as New Workbook, Same Location

gwest

New Member
Joined
Jun 20, 2013
Messages
3
I have a spreadsheet application that includes many macros, 15 visible sheets, and numerous hidden sheets. I have a macro button on the last sheet that saves a copy of this spreadsheet in the same folder where the main one is located (we call the newly saved copy "Scenario 1.xls"). However, Scenario 1.xls has all the functionality of the original workbook, macros and all obviously, and the file management can become circular if a user manipulates the macros in Scenario 1.xls. I would like to change the SaveScenario1 macro to instead save a new workbook (Scenario 1.xls) in the same location as the original, but to include only the visible worksheets and the values on them inside the new Scenario 1.xls. I would really appreciate any help in figuring this out. It seems like a fairly simple fix, but I have not been able to write a solution that does each of the things I need. I'm learning VBA and programming in general, so any extra explanations above and beyond the code itself are helpful to me. Thank you.

My Code, as it stands now, looks like this:

Sub SaveScenario1()
Dim myPath As String
myPath = ActiveWorkbook.Path
ActiveWorkbook.SaveCopyAs myPath & "\Scenario 1.xls"
MsgBox ("Current Scenario information was saved as workbook titled 'Scenario 1.xls'. You will continue working with the 'Current.xls' file")
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,215,548
Messages
6,125,468
Members
449,230
Latest member
ASBeard

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