Block access to only one worksheet in a workbook

I have a workbook that includes about 15 worksheets. I need to block access to individual worksheets using different passwords for each worksheet.
Who is Participating?
Martin LissConnect With a Mentor Older than dirtCommented:
Here's a VBA solution.
mhalciatiAuthor Commented:
I get a syntax error on

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
mhalciatiAuthor Commented:
Also, I'd like to make sure the workbook ALWAYS opens to sheet 1. I have named the sheets, so in the syntax I am using the name rather than sheet1, sheet2, etc. Is that correct?
Martin LissOlder than dirtCommented:
Yes the CodeName is the name in parenthesis. For example Sheet1(Budget) where 'Budget' is the CodeName.

Open a new workbook and go to ThisWorkBook -> WorkBook -> Workbook_SheetActivate event in the IDE. Is it different than Private Sub Workbook_SheetActivate(ByVal Sh As Object). If it is you can use CodeName rather than Sh.CodeName in your code.
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.