Greetings Everyone!
I have a worksheet that i have been using a macro to protect/unprotect the sheets. Recently, i thought instead of having the password visible in my code, i thought i'd hide it in a veryHidden sheet. (i can't just hide the code, as i have granted this workbook access to VBA object).
Protecting seems fine, but unprotecting gives me an error telling me my password is incorrect, and i should check caps lock.
My protect code is:
and it works perfectly
My unprotect is essentially identical, and gave me the above error:
I assume that this is a limitation of Excel VBA, but google isn't turning up anything relevant. (or i suck at google?).
Thanks in advance!
I have a worksheet that i have been using a macro to protect/unprotect the sheets. Recently, i thought instead of having the password visible in my code, i thought i'd hide it in a veryHidden sheet. (i can't just hide the code, as i have granted this workbook access to VBA object).
Protecting seems fine, but unprotecting gives me an error telling me my password is incorrect, and i should check caps lock.
My protect code is:
Code:
Sub protect()Dim ws As Worksheet
Dim yomomma As String
yomomma = Sheet3.Range("B6").Text
For Each ws In Sheets
ws.protect password:=yomomma, UserInterfaceOnly:=True
Next ws
End Sub
My unprotect is essentially identical, and gave me the above error:
Code:
Sub unprotect()Dim ws As Worksheet
For Each ws In Worksheets
Dim yomomma As String
yomomma = Sheet3.Range("B6").Text
ws.unprotect password:=yomomma
Next ws
End Sub
I assume that this is a limitation of Excel VBA, but google isn't turning up anything relevant. (or i suck at google?).
Thanks in advance!