Consulting

Results 1 to 4 of 4

Thread: Solved: Protection Problems

  1. #1
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location

    Solved: Protection Problems

    A few weeks ago I asked for assistance in setting up protection. I have found that I need to modify some cells and now I can't remove the protection. I've taken out the protection line with the password but when I try to unlock the worksheet it still requires a password.
    Can someone please explain what is happening and how to correct this. See the code below,
    [VBA]
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    ' Sh.Protect Password:="pass", UserInterfaceOnly:=True
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Intersect(Target, Sh.Range("B8:O34")) Is Nothing Then
    Select Case Target.Value
    Case "V.5", "V1" To "V999"
    Target.Interior.ColorIndex = 35

    Case "PL.5", "PL1" To "PL999"
    Target.Interior.ColorIndex = 34

    Case "SL.5", "SL1" To "SL999", "FS.5", "FS1" To "FS999"
    Target.Interior.ColorIndex = 36

    Case "BL.5", "BL1" To "BL999"
    Target.Interior.ColorIndex = 36

    Case Is = "ML.5", "ML1" To "ML999"
    Target.Interior.ColorIndex = 24

    Case Else
    'No conditions met, so make it normal
    Target.Interior.ColorIndex = -4142
    End Select
    End If
    End Sub
    [/VBA]
    It is very frustrating to be unable to work on your own spreadsheet. Thanks
    Gary

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    If the worksheet is protected, you will need to unprotect it. Commenting out the line will not unprotect it. Go to Tools | Protection | Unprotect Worksheet and enter the password.

  3. #3
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location
    That is my problem, no matter what I do I can't unprotect, with or without the password, with or without that line commented out.

    What do I do now?

  4. #4
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location

    SOLVED

    Disreguard, apparently the password in the vba code was diffierent from the sheet password. After using different variations of the passwords I normally use I was unable to unprotect it.
    Thanks
    Gary

Posting Permissions

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