How can I test when any worksheet within a workbook is selected
Hi
Is there a function out there to do this? Reason: I want to restrict groups of users so they can only see the sheets that are relevant to their job. If they move to a sheet they are restricted from seeing I want to make it invisible and return them to a sheet that all users can access. I can do this if I put code into each worksheet but was hoping there might be a more central way of doing it. Peter |
How can I test when any worksheet within a workbook is selected
Here’s what I’m thinking:
You could use something like this: Private Sub Workbook_Open() pwd = InputBox("Please enter password.") If pwd = "secret" Then Worksheets(2).Visible = -1 Else Worksheets(2).Visible = 2 End If End Sub Which will ask for a password when the file is opened and based on tha password you could have a series of ElseIf statements asking for th various passwords. Setting .Visible = 2 makes the Sheet “Very Hidden and no one will be able to tell it’s even there and setting it to – makes it visible. You could then go to Tools-VBAProject Properties i the VBA Editor and lock the project for viewing and protect that with password. I’m sure you could create your own form with a password field tha masks input, but the rest of this could be perfect for what you want -- Message posted from http://www.ExcelForum.com |
How can I test when any worksheet within a workbook is selected
Hi
Thanks but it's not what I am after. When any worksheet within a workbook is activated I would like to be able to trap which one it is and if necessary make the visible property = false. Note: I am using the username to determine who is able to see what sheet. I have about 10 worksheets that I want to be able to control in this way (and about 400 workbooks). Peter |
All times are GMT +1. The time now is 05:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com