Protect / Unprotect Removal VBA

  • I inherited a file that uses a password protect/unprotect macro tied to a button that hides rows. I'd like to remove the password but keep the hidden rows functionality but can't figure out how to do so. Here's the code as written: Application.ScreenUpdating = False
    Range("L11").Select
    Sheets("Inputs").Activate
    ActiveSheet.Unprotect Password:="todd"
    For Each cell In Range("b10:b200")
    If cell.Value = 1 Then cell.EntireRow.Hidden = True
    Next cell
    Range("A1").Activate
    ActiveSheet.Protect Password:="todd"
    Sheets("Land Inv").Activate
    ActiveSheet.Unprotect Password:="todd"
    For Each cell In Range("A10:A200")
    If cell.Value = 1 Then cell.EntireRow.Hidden = True
    Next cell

  • Re: Protect / Unprotect Removal VBA


    If you want to simply remove the specific password:


    Remove everything after password in the code...
    So

    Code
    ActiveSheet.Unprotect Password:="todd"


    Becomes

    Code
    ActiveSheet.Unprotect Password


    Etc...


    This should remove the specific password while allowing you to lock/unlock the sheet by clicking the protect worksheet button.


    If, more specifically, you want to remove the need to have the sheet protected/unprotected, I will defer to someone else's expertise... I think it would be more complex than simply removing those lines of code that contain password, but you could give it a shot...


    Hope this helps...

  • Re: Protect / Unprotect Removal VBA


    Not quite what I'm looking for but thanks for the reply. I want to remove the entire piece of protect/unprotect, as if it doesn't exist at all, like a normal worksheet/workbook.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!