Locked Cells?
I assume your are using the on change event... You need to turn protection
off to make your update. Here is some code for you so use as a guideline.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
Application.EnableEvents = False
If Target.Address = "$A$1" Then
ActiveSheet.Unprotect
'Your other code here...
ActiveSheet.Protect
End If
ErrorHandler:
Application.EnableEvents = True
End Sub
HTH
"Kevin Baker" wrote:
Row B and C both need to be locked to prevent the user from entering data,
however, I have code that puts a formula into these cells when the user
enters a date into Cell A. When I lock the cells and protect the sheet, I
get an error because the code it trying to add the formula to a locked cell.
Is there any way around this?
Thanks,
Kevin
|