Hello Everyone,
I wrote some code to protect/unprotect all of the worksheets in my workbook, and when I run the code in the vba editor it works perfectly fine.
However, I added some shapes to my excel file and then assign the macros to those shapes, so the macro could be run at the click of a button, and now its asking me for a password when I run the macro from the button.
Also, entering the password used to lock the cells doesnt work. Here is the code:
Thanks in advanced gals and guys!
I wrote some code to protect/unprotect all of the worksheets in my workbook, and when I run the code in the vba editor it works perfectly fine.
However, I added some shapes to my excel file and then assign the macros to those shapes, so the macro could be run at the click of a button, and now its asking me for a password when I run the macro from the button.
Also, entering the password used to lock the cells doesnt work. Here is the code:
Code:
Sub UnProtect()
'Dim ps As String
Application.ScreenUpdating = False
Application.Calculation = xlManual
'ps = "modeldevrocks"
For i = 1 To Sheets.count
Sheets(i).UnProtect Password:="modeldevrocks"
Next i
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
End Sub
////////////////////////////////////////////////
Sub Protect()
'Dim ps As String
Application.ScreenUpdating = False
Application.Calculation = xlManual
'ps = "modeldevrocks"
For i = 1 To Sheets.count
Sheets(i).Protect Password:="modeldevrocks"
Next i
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
End Sub
Thanks in advanced gals and guys!