Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel VBA - Removing worksheet passwords from a group in one workbook

Posted on 2013-11-24
5
Medium Priority
?
359 Views
Last Modified: 2013-11-25
I have a workbook with an ever-changing number of worksheets (between 2 and 8).  Each worksheet has its own password and as soon I open the workbook up, I'd like to be prompted to unprotect each of the sheets.
Can someone help me code this?
0
Comment
Question by:brothertruffle880
  • 2
  • 2
5 Comments
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 39673490
Private Sub Workbook_Open()
Dim sht As Worksheet

For Each sht In Worksheets
    sht.Unprotect
Next

End Sub

Open in new window

0
 
LVL 4

Expert Comment

by:yuppydu
ID: 39673911
Every sheet has a different password, or they are just protected?
0
 

Author Comment

by:brothertruffle880
ID: 39674011
Each sheet has its own password.  The Jan sheet has password "January", The feb sheet has "february", etc.
0
 

Author Closing Comment

by:brothertruffle880
ID: 39674210
Thank you Martin.  Works perfectly.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39674966
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question