I need to lock multiple cells in a different protected worksheet but the same workbook after entering data by macro. Which works fine for the first data range, but it always breaks at the second range.I tried this:
ActiveWorkbook.Worksheets("Summary").Range("C3").Value = Range("B18").Value + Range("C18").Value
ActiveWorkbook.Worksheets("Summary").Unprotect Password:="password"
ActiveWorkbook.Worksheets("Summary").Protect Password:="password", UserInterFaceOnly:=True
ActiveWorkbook.Worksheets("Summary").Range("A11:B15", "C3").Locked = True
I also tried this
ActiveWorkbook.Worksheets("Summary").Unprotect Password:="password"
ActiveWorkbook.Worksheets("Summary").Protect Password:="password", UserInterFaceOnly:=True
ActiveWorkbook.Worksheets("Summary").Range("A11:B15").Locked = True
ActiveWorkbook.Worksheets("Summary").Range("C3").Value = Range("B18").Value + Range("C18").Value
ActiveWorkbook.Worksheets("Summary").Range("C3").Locked = True
Each time they stop at the Range C3. For the first script, I removed ,"C3", and it is fine; for the second, I removed the whole line, it works. But i really need to lock C3 from editing. Any suggestions for how to do it? The Error message is always Run-time error '1004': Unable to set the locked property of the Range class.