Dear all,
This is my code in order to protect some rows and columns of my sheet.
Then in the sheet, I cannot do anything in any cell because I am told the sheet is protected.
I though doing means that I am only protecting the cells I want and this is also what is suggested in this page:Lock only a few cells on a worksheet - Excel - Office.com
I did what they suggest to compare, recorded the macro and it gave me something similar to my code so I don't know where is my mistake.
Any ideas?
Thank you
Ambre
This is my code in order to protect some rows and columns of my sheet.
Rich (BB code):
Sheets("Purchasing Plan").Select
ActiveSheet.Unprotect "PJMS"
Cells.Select
Selection.EntireColumn.Hidden = False
Selection.EntireRow.Hidden = False
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Rows("1:14").Select
Selection.Locked = True
Selection.FormulaHidden = False
Range("A:E,H:H,K:T,CN:CS,CV:CW").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect "PJMS", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowSorting:= True, AllowFiltering:=True 'protection de la feuille
Range("A1").Select
Then in the sheet, I cannot do anything in any cell because I am told the sheet is protected.
I though doing means that I am only protecting the cells I want and this is also what is suggested in this page:Lock only a few cells on a worksheet - Excel - Office.com
I did what they suggest to compare, recorded the macro and it gave me something similar to my code so I don't know where is my mistake.
Any ideas?
Thank you
Ambre
Last edited: