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
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