Hi!
I have the following macro that I’d like to modify so before the file is closed it will save it with the “worksheet” name of the original file. As you can see the macro currently takes each worksheet from the main file and saves it as the worksheet name and adds the year to the end of it before it saves it. I’d like the macro to also add a password (“password to open” in the general options)… I’d like the macro to be only the worksheet name.
Any help with the code is always appreciated!
Thanks!!
Lana
Sub SaveWorksheets()
Dim wsh As Worksheet
Dim strDate As String
‘Turn off screen updating
Application.ScreenUpdating = False
For Each wsh In Worksheets
Select Case wsh.Name
‘Don’t copy & save these worksheets
Case “pay grades”, “date vlookup”, “download”, “translation”, “COPY DATABASE”
‘Do copy & save all the other worksheets
Case Else
wsh.Select
Range(“A1″).Select
wsh.Copy
With ActiveWorkbook
‘Save each worksheet with the worksheet name & 2006 as the file name
.SaveAs Filename:=ActiveSheet.Name & ” 2006″ & “.xls”
‘Close the original file without saving it
.Close SaveChanges:=False
End With
End Select
Next wsh
With ActiveWorkbook
‘Close original file without saving it
.Close SaveChanges:=False
End With
End Sub