Hi all,
I am having trouble with a macro for unprotecting a sheet keeping specific cells locked then clearing contents of other cells then reproect the sheet.
I wrote one for one sheet which works and I have re used this but it keeps saying Unable to set the Locked property of the Range class.
Can anyone see what I've done wrong?
Sub AllNew()
With Sheet7
.Unprotect
Cells.Locked = False
[A13:J13, J14:J53, I54:J56, I1:J3].Locked = True
[A14:I53].ClearContents
[B9].Select
.Protect
End With
End Sub
The code that worked is:
Sub NewInvoice()
With Sheet1
.Unprotect
Cells.Locked = False
[A19:J19, I1:J3, I43:J45, I50:I54, B50:B54, B10:B14].Locked = True
'Clear details of last sale
[A20:I41, I9, B9, B49, I49].ClearContents
[B9].Select
.Protect
End With
End Sub
I don't know why it works with one sheet and not the other.
All help gratefully recieved.
I have attached the sheet in case its something on the sheet rather than the code,
Thanks again
Bookmarks