G
Guest
I have code that locks the majority of the cells in my spreadsheet. I then have code that unlocks a group of those cells. The code that unlocks the cells gives me a run-time error 1004: Unable to set the Locked property of the Range class. I don't understand why I'm getting this error. The .Locked = False line is the problem line. The syntax looks right. Any help would be great. Thanks in advance. The code follows
Private Sub optNonUniformed_Click(
Worksheets("TIME AND LEAVE").Protect UserInterfaceOnly:=Tru
Range("A540").Interior.ColorIndex = 2
Range("A540").Locked = Tru
Range("C55,A6:B9,A12:B15,D16,F16,H16,J16,L16,N16,P16,N34:N40,D1011,F10:F11,H10:H11,J10:J11,L10:L11,N10:N11,P1011,C1315,C34:C40").Interior.ColorIndex = xlNon
Range("D1011,F10:F11,H10:H11,J10:J11,L10:L11,N10:N11,P1011,C1315,C34:C40").Locked = Fals
End Sub
Private Sub optNonUniformed_Click(
Worksheets("TIME AND LEAVE").Protect UserInterfaceOnly:=Tru
Range("A540").Interior.ColorIndex = 2
Range("A540").Locked = Tru
Range("C55,A6:B9,A12:B15,D16,F16,H16,J16,L16,N16,P16,N34:N40,D1011,F10:F11,H10:H11,J10:J11,L10:L11,N10:N11,P1011,C1315,C34:C40").Interior.ColorIndex = xlNon
Range("D1011,F10:F11,H10:H11,J10:J11,L10:L11,N10:N11,P1011,C1315,C34:C40").Locked = Fals
End Sub