Please help,
For some reason every time I try to lock a cell based on a check box it gives me a 1004 error. Any suggestions or help would be appreciated. Code is below.
Private Sub chkCar_Click()
If chkCar.Value = False Then
Sheet1.Unprotect
Sheet1.Cells(30, 3).Interior.ColorIndex = 15
Sheet1.Cells(30, 3).Interior.Pattern = xlSolid
Sheet1.Cells(30, 3).Font.ColorIndex = 2
Sheet1.Cells(30, 3) = "LOCKED"
Sheet1.Range("C30").Locked = True
Sheet1.Protect
ElseIf chkCar.Value = True And Application.UserName = "TestUser" Then
Sheet1.Unprotect
Sheet1.Cells(30, 3).Interior.ColorIndex = 2
Sheet1.Cells(30, 3).Interior.Pattern = xlSolid
Sheet1.Range("C30").Locked = False
Sheet1.Protect
End If
End Sub
Billy