EliseFreedman
Programmer
Hi All
Im having an issue with using vba to unprotect data in a spreadsheet
Ive got a master spreadsheet which is protected with a password to stop users fiddling with the data. The spreadsheet contains filters which users can utilise to customise the spreadsheet to fit their own requirements. The filtered data will be exported to another spreadsheet. I am wanting the new spreadsheet to be unprotected.
I have tried the following code to unprotect the newly created spreadsheet but although I can see that the code is running, the sheets are still protected. What am I doing wrong
Im having an issue with using vba to unprotect data in a spreadsheet
Ive got a master spreadsheet which is protected with a password to stop users fiddling with the data. The spreadsheet contains filters which users can utilise to customise the spreadsheet to fit their own requirements. The filtered data will be exported to another spreadsheet. I am wanting the new spreadsheet to be unprotected.
I have tried the following code to unprotect the newly created spreadsheet but although I can see that the code is running, the sheets are still protected. What am I doing wrong
Code:
Windows("DSEStatusReport.xls").Activate
Set wbNew = ActiveWorkbook
On Error Resume Next
For Each wSheet In Worksheets
wSheet.Unprotect Password:="HealthyWorking"
MsgBox "unprotecting"
Next wSheet
If Err <> 0 Then
MsgBox "You have entered an incorect password. All worksheets could not " & _
"be unprotected.", vbCritical, "Incorect Password"
End If
On Error GoTo 0