I have created the code below so that once a value is entered any of four columns the cell becomes locked.
The problem I have is that the cells also have validation to only allow dates. Yet now I am using this code it will allow other values.
EDIT: Sorry without the If statement it would allow any other values.
I'd like to know the technicalities of why this is happening and also if my workaround is ok.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Select Case Target.Column
Case Is = 6, 7, 10, 11
ThisWorkbook.ActiveSheet.Unprotect Password:="armoured"
Target.Locked = True
ThisWorkbook.ActiveSheet.Protect Password:="armoured"
If Target.Value Like "##/##/####" Then
Exit Sub
Else
ThisWorkbook.ActiveSheet.Unprotect Password:="armoured"
Target.Value = ""
End If
End Select
End Sub