Password Protected Worksheet without Password

wmunsey81

New Member
Joined
Nov 30, 2017
Messages
29
I just put in VBA for 'ThisWorkbook:

Private Sub Workbook_Open()
OpenWHSE.Show
Sheet2.Protect Password:=True, UserinterfaceOnly:=False
End Sub

After running it, it protected the stuff I want. I want to do some more editing and go to unprotect, and says I didn't put in the correct password... I never put in a password in the first place. Is there a default? Help! I don't have a previous version of this and I think I locked myself out of my own excel.:mad:
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
This section is setting the password
Code:
Password:=True
so you have given it a password of TRUE (all caps)
 
Last edited:
Upvote 0
This section is setting the password
Code:
Password:=True
so you have given it a password of TRUE (all caps)

Still not letting me in. Going to Unprotect Sheet and says incorrect password

Code:
[COLOR=#000000][FONT=verdana]Private Sub Workbook_Open()[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Sheet1.Protect Password:=True, UserinterfaceOnly:=True, AllowFiltering:=True[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Sheet3.Protect Password:=True, UserinterfaceOnly:=True, AllowFiltering:=True[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Sheet4.Protect Password:=True, UserinterfaceOnly:=True, AllowFiltering:=True[/FONT][/COLOR]
[COLOR=#000000][FONT=verdana]Sheet5.Protect Password:=True, UserinterfaceOnly:=True, AllowFiltering:=True[/FONT][/COLOR]


[COLOR=#000000][FONT=verdana]End Sub[/FONT][/COLOR]

Saw this in a post and did it... biggest mistake ever.
 
Upvote 0
Gives "Run-time error '1004': if done in VBA and same message if going into Review... Running 2016 Excel.
 
Upvote 0
Just seen post#5

Glad it's sorted & thanks for the feedback
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

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