Consulting

Results 1 to 3 of 3

Thread: Protect/Unprotect

  1. #1

    Protect/Unprotect

    Hi,

    Using following to lock a column & prevent additional rows columns being created.

    HTML Code:
    Private Sub protectit()
    
    Cells.Locked = False
    Range("A1:A2000").Locked = True
    
    ActiveSheet.Protect AllowInsertingRows:=False, AllowInsertingColumns:=False
    
    ActiveSheet.Protect Password:="Test"
    
    End Sub
    However just selecting 'unprotect sheet' on ribbon deactivates without asking for password.

    Any ideas?

    thanks
    Jon

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Private Sub protectit()
    Cells.Locked = False
    Range("A1:A2000").Locked = True
    ActiveSheet.Protect Password:="Test", AllowInsertingRows:=False, AllowInsertingColumns:=False
    End Sub
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Cheers P45,

    Works fine

    regards
    Jon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •