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
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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


 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top