Relacing default Excel message box when user attempts to change locked cell on protected sheet.

C

Chrisso

Hi All

I have a sheet full of data that is all locked cells and the sheet is
protected. I allow the users to select cell but not to change them at
all. When they try to they get the default mesasge from Excel:

"The cell or chart you are trying to change is protected and therefore
read-only.

To modify a protected cell or chart " <...goes on to tell user how to
remove protection...> "

I would like to be able to replace this message with one that just
says "You cannot edit these cells" or something similarly direct. I
dont want them to have directions on how to try and unprotect the
sheet .

Is there a way to do this through VB? through the Application object
maybe but I have no idea? Anyone??

Thanks in advance
Chrisso
 
C

Chrisso

Thanks Tom. That is a pity.

Maybe I could implement this myself by using a cells locked property
and the Worksheet_Change event:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Locked Then
MsgBox "You cannot edit this cell", vbCritical
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub

However I would have to leave the sheet unprotected otherwise the
Excel message (which I am trying to avoid) pops up before my event
code is called. Then I have not prevented other changes like cell
colour changing, etc etc ..... and I am re-inventing the wheel.....
sob!

Chrisso
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top