.
Paste in USERFORM :
Dim HFD As Integer, HFR As Integer
Dim N As Long, F As Long, Pass As String
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheets("SetUp").Visible = xlSheetVisible
For N = 3 To HFR
If ComboBox1.Value = Sheets("SetUp").Cells(15, N).Value Then
Exit For
End If
Next N
If TextBox1.Value = Sheets("SetUp").Cells(16, N).Value Then
Sheets("SetUp").Visible = xlSheetVeryHidden
MsgBox Range("SetUp!C10").Value, , Range("SetUp!C9").Value & " " & Sheets("SetUp").Cells(15, N).Value
Unload UserForm1
Sheets("SetUp").Visible = xlSheetVisible
Pass = Sheets("SetUp").Range("K12").Value
Sheets("SetUp").Visible = xlSheetVeryHidden
For F = 17 To HFD
If UCase(Sheets("SetUp").Cells(F, N).Value) = "X" Then
Sheets(Sheets("SetUp").Cells(F, 2).Value).Visible = xlSheetVisible
End If
If UCase(Sheets("SetUp").Cells(F, N).Value) = "P" Then
Sheets(Sheets("SetUp").Cells(F, 2).Value).Visible = xlSheetVisible
Sheets(Sheets("SetUp").Cells(F, 2).Value).Protect Password:=Pass
End If
Next F
Else
MsgBox Range("SetUp!C6").Value, , Range("SetUp!C7").Value
TextBox1.Value = ""
Sheets("SetUp").Visible = xlSheetVeryHidden
End If
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
Unload UserForm1
End Sub
Private Sub UserForm_Initialize()
Dim WkSht As Worksheet
Application.ScreenUpdating = False
For Each WkSht In Worksheets
If Not WkSht.Name = "Intro" Then WkSht.Visible = xlSheetVeryHidden
Next WkSht
Sheets("SetUp").Visible = xlSheetVisible
HFD = Sheets("SetUp").Range("B65536").End(xlUp).Row
HFR = Sheets("SetUp").Range("IV15").End(xlToLeft).Column
UserForm1.Caption = Range("SetUp!C3").Value
Label3.Caption = Range("SetUp!C4").Value
For N = 3 To HFR
With ComboBox1
.AddItem Sheets("SetUp").Cells(15, N).Value
End With
Next N
Sheets("SetUp").Visible = xlSheetVeryHidden
Application.ScreenUpdating = True
End Sub
Paste in THISWORKBOOK :
Option Explicit
Dim WSht As Worksheet, Pass As String
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call HideAll
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Call HideAll
ThisWorkbook.Saved = True
End Sub
Private Sub Workbook_Open()
Application.ScreenUpdating = False
Sheets("SetUp").Visible = xlSheetVisible
Pass = Sheets("SetUp").Range("K12").Value
Sheets("SetUp").Visible = xlSheetVeryHidden
For Each WSht In ActiveWorkbook.Worksheets
Sheets(WSht.Name).Unprotect Password:=Pass
Next WSht
Call HideAll
UserForm1.Show
End Sub
Sub HideAll()
Application.ScreenUpdating = False
On Error Resume Next
For Each WSht In ActiveWorkbook.Worksheets
Sheets(WSht.Name).Unprotect Password:=Sheets(Sheets("SetUp").Cells(30, 11).Value)
If WSht.Name <> "Intro" Then WSht.Visible = xlSheetVeryHidden
Next WSht
Application.ScreenUpdating = True
End Sub