Colo
MrExcel MVP,
- Joined
- Mar 20, 2002
- Messages
- 1,659
- Office Version
- 2016
- 2003 or older
- Platform
- Windows
Hi. Why don't you use visible properties of worksheets.
In order to display the sheet, an user must use vba.
So like this time, I always use this properties.
Please describe the following code to ThisWorkbook module.
I assume that Sheet2 is a data sheet.
Please change a sheet name according to your environment.
'ThisWorkbook module-----------from here---------------
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Const pwd As String = "1111"
If Sh.Name <> "Sheet1" Then Exit Sub
If InputBox("Password Please") <> pwd Then Exit Sub
With Sheets("Sheet2")
.Visible = xlSheetVisible
Application.Goto .Cells(1.1)
End With
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name <> "Sheet2" Then Exit Sub
Sheets("Sheet2").Visible = xlSheetVeryHidden
End Sub
'------------------------------to here------------------
In order to display the sheet, an user must use vba.
So like this time, I always use this properties.
Please describe the following code to ThisWorkbook module.
I assume that Sheet2 is a data sheet.
Please change a sheet name according to your environment.
'ThisWorkbook module-----------from here---------------
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Const pwd As String = "1111"
If Sh.Name <> "Sheet1" Then Exit Sub
If InputBox("Password Please") <> pwd Then Exit Sub
With Sheets("Sheet2")
.Visible = xlSheetVisible
Application.Goto .Cells(1.1)
End With
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name <> "Sheet2" Then Exit Sub
Sheets("Sheet2").Visible = xlSheetVeryHidden
End Sub
'------------------------------to here------------------