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:
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
38,559
Office Version
365
Platform
Windows
This section is setting the password
Code:
Password:=True
so you have given it a password of TRUE (all caps)
 
Last edited:

wmunsey81

New Member
Joined
Nov 30, 2017
Messages
29
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.
 

wmunsey81

New Member
Joined
Nov 30, 2017
Messages
29
Gives "Run-time error '1004': if done in VBA and same message if going into Review... Running 2016 Excel.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
38,559
Office Version
365
Platform
Windows
Just seen post#5

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

Watch MrExcel Video

Forum statistics

Threads
1,095,350
Messages
5,443,953
Members
405,258
Latest member
daveyf

This Week's Hot Topics

Top