Hi
I'm using Excel 2003.
I've finally mastered copying worksheets to another workbook (turns out there were hidden worksheets I didn't know about causing issues with some of the formulae). Now I want to be able to protect some cells in the copy but not others.
The code when I run a macro for this routine is as follows (
(but it's not working - I can still change contents in the cell):
The entire code is:
Also, what can I do to stop the window from allowing me to see the new workbook copying?
Thanks.
I'm using Excel 2003.
I've finally mastered copying worksheets to another workbook (turns out there were hidden worksheets I didn't know about causing issues with some of the formulae). Now I want to be able to protect some cells in the copy but not others.
The code when I run a macro for this routine is as follows (
(but it's not working - I can still change contents in the cell):
Code:
Sheets("WSD").Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("L4:M40").Select
Selection.Locked = True
Selection.FormulaHidden = False
The entire code is:
Code:
Sub copyWorkbook()
Dim ws As Worksheet
Dim NewWB As Workbook
Sheets(Array("WSA", "WSB", "WSC", "WSD", "WSE", "WSF")).Copy
Set NewWB = ActiveWorkbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.CutCopyMode = False
Sheets("WSD").Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("L4:M40").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
NewWB.SaveCopyAs Filename:="E:\My Documents\MyWB_" & Format(Now(), "YYYYMMDD") & ".xls"
ActiveWindow.Close
Application.ScreenUpdating = True
End Sub
Also, what can I do to stop the window from allowing me to see the new workbook copying?
Thanks.