I have a very involved Workbook which embodies many formulae.
To ensure that each worksheet and process is not inadvertently corrupted I have initiate two strategies.
The first was to construct macros which write formulae to workbooks, sometimes on demand but mostly when called by some other action, eg formulae have been deliberately overwritten by values and so need to be restored for future operations.
The second, designed to prevent any inexperienced or careless handling I have passworded every sheet in the workbook:
Sub pwd_protect()
Dim wsPass= Range("xxxxxxxxx!Yn").value [I'm really perturbed that the password is visible on a certain worksheet]
For Each ws In ThisWorkbook.Sheets
ws.Protect wsPass
next ws
End Sub
That macro works perfectly for all Worksheets except one! That I cannot understand.
Checking upon the ribbon of that sheet shows that I need to Unprotect it should I wish to edit and yet I am able.
Secondly, if I copy that worksheet directly to another new worksheet the behaviour is the same.
As a final test I created a new blank worksheet and when I ran the above macro protection was installed.
This workbook is designed so that a new 'clone' of it can be created for each new year. It is also a rewrite of last the workbook from the last year and I also note that the corresponding sheet there does not accept protection.
Before I begin to rewrite that worksheet in the new workbook I'd appreciate any advice as to what might save me some work. Many thanks for any thoughts.
To ensure that each worksheet and process is not inadvertently corrupted I have initiate two strategies.
The first was to construct macros which write formulae to workbooks, sometimes on demand but mostly when called by some other action, eg formulae have been deliberately overwritten by values and so need to be restored for future operations.
The second, designed to prevent any inexperienced or careless handling I have passworded every sheet in the workbook:
Sub pwd_protect()
Dim wsPass= Range("xxxxxxxxx!Yn").value [I'm really perturbed that the password is visible on a certain worksheet]
For Each ws In ThisWorkbook.Sheets
ws.Protect wsPass
next ws
End Sub
That macro works perfectly for all Worksheets except one! That I cannot understand.
Checking upon the ribbon of that sheet shows that I need to Unprotect it should I wish to edit and yet I am able.
Secondly, if I copy that worksheet directly to another new worksheet the behaviour is the same.
As a final test I created a new blank worksheet and when I ran the above macro protection was installed.
This workbook is designed so that a new 'clone' of it can be created for each new year. It is also a rewrite of last the workbook from the last year and I also note that the corresponding sheet there does not accept protection.
Before I begin to rewrite that worksheet in the new workbook I'd appreciate any advice as to what might save me some work. Many thanks for any thoughts.