dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,352
- Office Version
- 365
- 2016
- Platform
- Windows
I have a spreadsheet I want to password protect to stop users from wrecking it accidentally.
In the code behind one of the sheets I want protected, I have the following code at the top of that sheet
Can that code only be used for procedures in that sheet or is it a global thing, being able to be used anywhere?
After some trial and error, I have found it only works for that section the code is stored. How can I write the code so that the constant I store the password in is a global thing so I only need to update it once?
In the code behind one of the sheets I want protected, I have the following code at the top of that sheet
VBA Code:
Option Explicit
Const ToUnlock As String = "word"
Can that code only be used for procedures in that sheet or is it a global thing, being able to be used anywhere?
After some trial and error, I have found it only works for that section the code is stored. How can I write the code so that the constant I store the password in is a global thing so I only need to update it once?
Last edited: