VBA error message

julianchan58

New Member
Joined
Sep 11, 2019
Messages
2
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

Board Regular
Joined
Dec 28, 2017
Messages
72
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


 

Forum statistics

Threads
1,084,967
Messages
5,380,881
Members
401,704
Latest member
DravenExcel

Some videos you may like

This Week's Hot Topics

Top