Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("C")) Is Nothing Then Exit Sub
Application.EnableEvents = False
With Sheets("BdD")
For Each cel In Intersect(Target, Columns("C"))
If cel.Row >= 8 Then
If cel.Offset(0, 1) = 0 Then
i = .Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(i, 1) = Range("C2")
.Cells(i, 2) = cel.Offset(0, -1)
.Cells(i, 3) = Range("C4")
.Cells(i, 4) = Range("C5")
.Cells(i, 5) = cel.Value
Else
i = cel.Offset(0, 1) + 1
.Cells(i, 5) = cel.Value
End If
cel.FormulaR1C1 = "=IFERROR(INDEX(Tableau1[Imputation],RC[1]),0)"
End If
Next
End With
Application.EnableEvents = True
End Sub
La référence au projet se situe ici dans le code
.Cells(i, 2) = cel.Offset(0, -1)
sachant que le projet est en colonne B, soit colonne -1 par rapport à la valeur d'imputation introduite