A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Try the code below.
Andreas.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OldValue, NewValue
On Error GoTo ExitPoint
If (Target.Column = 5) Or (Target.Column = 10) Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo ExitPoint
Else
If Target.Value = "" Then
GoTo ExitPoint
Else
Application.EnableEvents = False
NewValue = Target.Value
Application.Undo
OldValue = Target.Value
If OldValue = "" Then
Target.Value = NewValue
Else
If InStr(1, OldValue, NewValue) = 0 Then
Target.Value = OldValue & ", " & NewValue
Else
Target.Value = OldValue
End If
End If
End If
End If
End If
ExitPoint:
Application.EnableEvents = True
End Sub