monoj chakraborty
Member
Hey good people,
I am trying to protect non-adjacent ranges across multiple worksheets and here's the snipped of the code I have written :
but the code is breaking at the line Rng.Locked with the error :
The workbook is also attached for ready reference here.
Kindly help me with in case I am missing anything in the code...
appreciate the help.
I am trying to protect non-adjacent ranges across multiple worksheets and here's the snipped of the code I have written :
Code:
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "topsheet" Then
Set Rng = Application.Union(Range("m:n"), Range("ad:at"))
ws.Cells.Locked = False
Rng.Locked = True
ActiveSheet.Protect Password:="biscuits", DrawingObjects:=False, Contents:=True, Scenarios:=False
End If
Next
but the code is breaking at the line Rng.Locked with the error :
The workbook is also attached for ready reference here.
Kindly help me with in case I am missing anything in the code...
appreciate the help.