|
|
|
|
|
|
Excel
|
Restrict User To 1 Sheet
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000
|
Submitted by:
|
lucas
|
Description:
|
There are several sheets in the book but you only want to allow users access to 1 sheet.
|
Discussion:
|
You may not want to hide other sheets in the book for some reason but you only want the user to be able to access 1 sheet which you determine.
Note: This is a very low level of security, more likely use would be for convenience where users would not try to bypass the effect. It can be easily defeated by simply setting their macro security level to high. If you need more security try Johskie's kb entry: Force User to Enable Macros: located at: http://www.vbaexpress.com/kb/getarticle.php?kb_id=578
|
Code:
|
instructions for use
|
Put this code In the ThisWorkbook module:
Option Explicit
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Worksheets(1).Activate
End Sub
|
How to use:
|
- Open the Visual Basic Editor by going to tools-Macro's-Visual Basic Editor or use Alt-F11
- In the Project Explorer double click the ThisWorkbook object
- In the module pane paste the code above.
- Close the Visual Basic Editor by clicking the X in the upper right corner or go to File-Close
|
Test the code:
|
- Save and close the workbook
- Open the workbook again and you will only be able to access sheet1
|
Sample File:
|
user_can_only_access_sheet1.zip 5.89KB
|
Approved by mdmackillop
|
This entry has been viewed 421 times.
|
|