Forum Discussion
Sbookman
Aug 07, 2024Copper Contributor
Protecting Specific Tabs in a Workbook from Viewing
Hi,
I am trying to see if there is a way to protect/block specific tabs in an Excel workbook from viewing, not just editing. And is there a way to give different permissions/vies/access to different users within the same workbook?
For Example on below spreadsheet, I would like some users to be able to view just the 1st and 2nd tab and not the Budget tab. And have other be able to view all other tabs.
I would appreciate any help or insight.
Thank you,
1 Reply
- Harun24HRBronze Contributor
Sbookman Excel is not really appropriate for these type of complex security. Either you can protect full workbook or you have to use some tricks but not documented security. Here one approach to protect a sheet with password to view. Lets try it. You download the attached file.
Private Sub Workbook_SheetActivate(ByVal Sh As Object) Dim MySheetName As String MySheetName = "HiddenSheet" 'The sheed which I want to hide. If Application.ActiveSheet.Name = MySheetName Then Application.EnableEvents = False Application.ActiveSheet.Visible = False response = Application.InputBox("Password", "Enter Password", "", Type:=2) If response = "123456" Then 'Unhide Password. Application.Sheets(MySheetName).Visible = True Application.Sheets(MySheetName).Select End If End If Application.Sheets(MySheetName).Visible = True Application.EnableEvents = True End Sub