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

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?
brothertruffle880Asked:
Who is Participating?
 
Martin LissConnect With a Mentor Older than dirtCommented:
Private Sub Workbook_Open()
Dim sht As Worksheet

For Each sht In Worksheets
    sht.Unprotect
Next

End Sub

Open in new window

0
 
yuppyduCommented:
Every sheet has a different password, or they are just protected?
0
 
brothertruffle880Author Commented:
Each sheet has its own password.  The Jan sheet has password "January", The feb sheet has "february", etc.
0
 
brothertruffle880Author Commented:
Thank you Martin.  Works perfectly.
0
 
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.