Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-11-24
5
Medium Priority
?
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

660 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