[/FONT]
[FONT=Arial]Private Sub Worksheet_Change(ByVal Target As Range)[/FONT]
[FONT=Arial]Dim ColDeb As Long, ColFin As Long, NbOcc As Long, Lig As Long, Col As Long[/FONT]
[FONT=Arial]Application.DisplayAlerts = False[/FONT]
[FONT=Arial]If Not Intersect(Target, [saisie]) Is Nothing Then[/FONT]
[FONT=Arial] If Target.Count > 1 And Target.Count < Range("saisie").Count Then[/FONT]
[FONT=Arial] [/FONT][FONT=Arial]MsgBox "Attention: le décalage ne s'est pas fait correctement. Prière de supprimer un seul à la fois!", vbExclamation[/FONT]
[FONT=Arial] Exit Sub[/FONT]
[FONT=Arial] [/FONT][FONT=Arial]ElseIf Target.Count = 1 Then[/FONT]
[FONT=Arial] Application.EnableEvents = False[/FONT]
[FONT=Arial] [/FONT][FONT=Arial]'première colonne du champ "saisie"[/FONT]
[FONT=Arial] ColDeb = [saisie].Columns(1).Column[/FONT]
[FONT=Arial] 'dernière colonne du champ "saisie"[/FONT]
[FONT=Arial] ColFin = [saisie].Columns([saisie].Columns.Count).Column[/FONT]
[FONT=Arial] 'numéro de ligne dans le champ "saisie"[/FONT]
[FONT=Arial] Lig = Target.Row - Range("saisie")(1).Row + 1[/FONT]
[FONT=Arial] 'numéro de colonne dans le champ "saisie"[/FONT]
[FONT=Arial] Col = Target.Column - Range("saisie")(1).Column + 1[/FONT]
[FONT=Arial] 'nombre de choix actuel sur la ligne[/FONT]
[FONT=Arial] NbOcc = Application.CountA([saisie].Rows(Lig))[/FONT]
[FONT=Arial] 'si la cellule n'est pas vide[/FONT]
[FONT=Arial] If Target.Value <> "" Then[/FONT]
[FONT=Arial] 'ici on vérifie que le choix n'existe pas déjà[/FONT]
[FONT=Arial] [/FONT][FONT=Arial]If Application.CountIf(Range(Cells(Target.Row, ColDeb), Cells(Target.Row, ColFin)), Target.Value) = 1 Then[/FONT]
[FONT=Arial] If Col > NbOcc Then[/FONT]
[FONT=Arial] Range("saisie")(Lig, NbOcc).Value = Target.Value[/FONT]
[FONT=Arial] [/FONT][FONT=Arial]Target.ClearContents[/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial] 'si le choix existe déjà[/FONT]
[FONT=Arial] Else: Target.ClearContents[/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial] 'si la cellule est vide[/FONT]
[FONT=Arial] [/FONT][FONT=Arial]Else[/FONT]
[FONT=Arial] If Target.Column < ColFin Then[/FONT]
[FONT=Arial] For i = Target.Column To ColFin - 1[/FONT]
[FONT=Arial] Cells(Target.Row, i).Value = Cells(Target.Row, i + 1).Value[/FONT]
[FONT=Arial] Next[/FONT]
[FONT=Arial] Cells(Target.Row, ColFin).ClearContents[/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial] Application.EnableEvents = True[/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial]End If[/FONT]
[FONT=Arial]Application.DisplayAlerts = True[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]End Sub[/FONT]
[FONT=Arial]