Paraquat Pete
New Member
- Joined
- Feb 19, 2021
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hello. This is my first post on any type, though I have been reading several threads from your forums which has assisted me a lot.
But ... the threads on this and other forums have not assisted me with my issue namely VBA not protecting worksheets with a password and have tried various coding with the same effect.
The code is:
Sub lockdown()
For Each ws In ThisWorkbook.Worksheets
ws.Protect "Open"
Next ws
End Sub
I run the code on very small size (<2Mb) workbooks with the correct outcome - namely clicking the "Unprotect" button prompts a Unprotect Sheet Password message box. However, large workbooks (>4M) the code protects the sheets but does not lock it with a password. Clicking the Unprotect Sheet button unlocks the sheet. It is exactly the same coding. The sheets will lock manually with a password.
But ... the threads on this and other forums have not assisted me with my issue namely VBA not protecting worksheets with a password and have tried various coding with the same effect.
The code is:
Sub lockdown()
For Each ws In ThisWorkbook.Worksheets
ws.Protect "Open"
Next ws
End Sub
I run the code on very small size (<2Mb) workbooks with the correct outcome - namely clicking the "Unprotect" button prompts a Unprotect Sheet Password message box. However, large workbooks (>4M) the code protects the sheets but does not lock it with a password. Clicking the Unprotect Sheet button unlocks the sheet. It is exactly the same coding. The sheets will lock manually with a password.