VBA error message

julianchan58

New Member
Hi all,

My VBA used to run with no issue, but recently seeing "System Error &H80070057 (-2147024809)"

VBA simply protect all worksheets in the workbook. Am currently using Office 365 (running under Win10) . Any clue what could have caused the issue? many thanks!!!!!
__________________________________________
Sub protectsheet()
Dim ws As Worksheet
Dim pw As Variant


pwd = "finBkk20" ' Put your password here


For Each ws In Worksheets
ws.protect Password:=pwd
Next ws


Worksheets("Instruction").Activate


MsgBox ("All sheets protected")


End Sub
 

dnorm

New Member
Hi juliianchan58


I am not sure if this will help, this:
If this is a copy and paste of your macros, then this mightbe the reason - add the "d".

Sub protectsheet()
Dim ws As Worksheet
Dim
pwd As Variant


pwd = "finBkk20" ' Put your password here


For Each ws In Worksheets
ws.protect Password:=pwd
Next ws


Worksheets("Instruction").Activate


MsgBox ("All sheets protected")


End Sub


 

Some videos you may like

This Week's Hot Topics

Top