Protected Cell Message


Posted by Ian Bartlett on October 07, 2001 3:07 AM

Is it possible to display a custom messagebox in place of the standard Excel warning when a user tries to write to a protected cell? The idea is to lead the user to the cells where he should be entering data.



Posted by Mark O'Brien on October 08, 2001 11:28 AM

Yes it is. Just place this code on the sheet with the locked cells and modify the message.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Locked = True Then
MsgBox "Hey, I've been protected!!!"
Cancel = True
End If
End Sub

Any problems, just repost.