Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
Application.EnableEvents = False
Me.Unprotect
If Not Intersect(Target, [B:B,L:L]) Is Nothing Then
If Target.Value = "**" Then
Target.Value = Date
Target.NumberFormat = "DD/MM/YYYY"
End If
ElseIf Not Intersect(Target, [E1]) Is Nothing Then
If Target.Value = "" Then
Me.Range("A3:U3").AutoFilter Field:=Target.Column
Else
Me.Range("A3:U3").AutoFilter Field:=Target.Column, _
Operator:=xlFilterValues, _
Criteria1:="*" & CStr(Target.Value) & "*"
End If
ElseIf Not Intersect(Target, [A1:V1]) Is Nothing Then
If Target.Value = "" Then
Me.Range("A3:U3").AutoFilter Field:=Target.Column
Else
Me.Range("A3:U3").AutoFilter Field:=Target.Column, _
Operator:=xlFilterValues, _
Criteria1:=CStr(Target.Value)
End If
ElseIf Not Intersect([G:G], Target) Is Nothing Then
If Target = "**" Then Target = WorksheetFunction.Max([G:G]) + 1
End If
Me.Protect DrawingObjects:=False, Contents:=True, _
Scenarios:=False, AllowFormattingCells:=True, _
AllowFiltering:=True
Application.EnableEvents = True
End Sub