msgbox if cell is locked

  • Thread starter Thread starter scottnshelly
  • Start date Start date
S

scottnshelly

I should know this by now, but can't get it right. how do i display
msgbox if the user tries to click into a locked cell on a protecte
sheet?
thanks
 
There is also a way that you can't select locked cells but you want a msgbox

Try this in the sheet module

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cell As Range
Dim Ltrue As Boolean
For Each cell In Target
If cell.Locked Then Ltrue = True
Next
If Ltrue = True Then MsgBox "one or more cells in the selection are locked"
End Sub
 

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

Back
Top