Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Const SUPERVISOR_RANGE As String = "E1:H6"
Const ACTIVE_SHEET As String = "Sheet1"
Const PASSWORD As String = "arnel"
Const RANGE_TO_KICK_USER As String = "D1"
' SUPERVISOR_RANGE = the rectangular area where
' approval/disapproval is located. include
' the range where there is a checkbox.
' ACTIVE_SHEET = the sheet where the application for leave
' is located (my sample SHEET1)
' PASSWORD = the static password needed so
' user can "enter" the SUPERVISOR_RANGE
' RANGE_TO_KICK_USER when password is invalid you
' don't want the user to enter
' that range, instead put him
' on another range.
Static bolInSupervisor As Boolean
Dim rng1 As Range
Dim bolCellInSupervisor As Boolean
Dim strPass As String
On Error Resume Next
If ActiveSheet.Name = ACTIVE_SHEET Then
bolCellInSupervisor = False
Set rng1 = Intersect(Range(SUPERVISOR_RANGE), Target)
bolCellInSupervisor = (Not rng1 Is Nothing)
Err.Clear
If bolCellInSupervisor = True Then
If Not bolInSupervisor Then
strPass = InputBox("Please enter Supervisor password", "Password Required") & ""
bolInSupervisor = (strPass = PASSWORD)
If Not bolInSupervisor Then
Range(RANGE_TO_KICK_USER).Select
End If
End If
End If
End If
End Sub