G'day all,
Just wondering where to put the code to protect the sheet in this code?
Many thanks all!
Hayden
Just wondering where to put the code to protect the sheet in this code?
Many thanks all!
Hayden
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Resp As String
If Target.CountLarge = 1 And Not Intersect(Target, Range("G10:T172")) Is Nothing Then
ActiveSheet.Unprotect
With Target
Select Case .Value
Case "SDO", "STFN", "CDO", "CTFN" '<- Add more trigger values here if required
Resp = Application.InputBox("Please insert details of absenteeism", _
Title:="Absenteeism Details")
If Len(Resp) > 0 And Resp <> "False" Then
If Not .Comment Is Nothing Then
.Comment.Text .Comment.Text & vbLf & Resp
Else
.AddComment Text:=Resp
End If
End If
End Select
End With
End If