Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Albert Smith   on Oct 29 In MS Office Category.

  
Question Answered By: Daw Boonliang   on Oct 29

You need to set the EnableSelection property. You are probably protecting the
sheet, but still allowing the users to select both locked & unlocked cells. Tru
something like this:

Sub AAAA()
Call ProtectSht("Sheet1")
End Sub

Sub BBBB()
Call UnprotectSht("Sheet1")
End Sub

Private Sub ProtectSht(ShtName As String)
Sheets(ShtName$).Protect
Sheets(ShtName$).EnableSelection = xlNoSelection
End Sub

Private Sub UnprotectSht(ShtName As String)
Sheets(ShtName$).Unprotect
Sheets(ShtName$).EnableSelection = xlNoRestriction
End Sub

For greater security, you could add a password.

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Protect/Unprotect Or get search suggestion and latest updates.


Tagged: