Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cel As Range
Dim I As Integer
Dim Oldvalue As String
Dim Newvalue As String
For Each Cel In Target
If Not Intersect(Cel, [tableau_suivi_veille[#Data]]) Is Nothing Then
' Index de la ligne dans le tableau
I = Cel.Row - [tableau_suivi_veille[#Headers]].Row
Select Case True
' la ligne ci-dessous est à supprimer ou commenter pour traiter toutes les colonnes du tableau
Case Intersect(Cel, [tableau_suivi_veille[Section]]) Is Nothing
Case Cel = ""
Case Intersect(Cel, Me.Cells.SpecialCells(xlCellTypeAllValidation)) Is Nothing
Case Else
Application.EnableEvents = False
Newvalue = Cel.Value
Application.Undo
Oldvalue = Cel.Value
Select Case True
Case Oldvalue = "": Cel = Newvalue
Case Not InStr(1, Oldvalue & ",", Newvalue & ",") > 0 ' ne pas trouver 1 dans 10
Cel = Oldvalue & ", " & vbLf & Newvalue
Cel.EntireRow.AutoFit
End Select
Application.EnableEvents = True
End Select
With [tableau_suivi_veille[Date mise à jour]].Rows(I)
Application.EnableEvents = False
.Value = Now
.Columns.AutoFit
Application.EnableEvents = True
End With
End If
Next
End Sub