Sheets - xlVeryHidden

H

Hennie Neuhoff

Hi Guys
Excel 2003
A couple of sheets in my workbook contains confidential information.
Acess to these sheets is only possible via a password with the
following example:

Public Sub GoMenSh()
'Go to menusheet
If Sheets("MenuSheet").Visible = xlVeryHidden Then
GetPassw
ThisWorkbook.Worksheets("MenuSheet").Visible = True
Sheets("MenuSheet").Activate
Else
Sheets("MenuSheet").Select
End If
End Sub

I want to modify this code and delete the "else" section which means
that the user must always supply the password in order to get acess.
Once another sheet is selected, the confidential sheet should return
to its "xlVeryHidden" state.

I’m sure this is possible via the sheet's code - similar to the statement
Before_closure, I’m not sure how to do this.

As always, any assistance will be appreciated.
PS - I've got the option for user to select "hide sheet" ,via code but would
like to "automate" this in case he does not select it.
 
J

Jacob Skaria

Hi Hennie

Try the 'Deactiviate' event of the confidential sheet as below

Private Sub Worksheet_Deactivate()
Me.Visible = xlVeryHidden
End Sub

If you are keeping this sheet always hidden then replace your existing code
to get the password first and then..activate the sheet as below. Hope you
have some other sheet which is always visible.

Public Sub GoMenSh()
GetPassw
ThisWorkbook.Worksheets("MenuSheet").Visible = True
Sheets("MenuSheet").Activate
End Sub


If this post helps click Yes
 
L

Libby

Depending on how confidential your information is, it's worth remembering
that the contents of very hidden sheets can be exposed if the Excel file is
opened using Word.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top