1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long, Col_d As Long
Dim Feuil As String, Soc As String, Heure_RDV As String
Dim Date_RDV As Date
Dim Lig_h As Object
Application.ScreenUpdating = False
If Target.Column <> 4 Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target.Offset(0, -3) = "" Or Target.Offset(0, -2) = "" Or Target.Offset(0, -1) = "" Then Exit Sub
i = Target.Row
Feuil = Cells(i, "A")
Date_RDV = Cells(i, "B") * 1
Heure_RDV = Cells(i, "C")
Soc = Cells(i, "D")
Date_Dep = [I3]
Col_d = 3
Do While Sheets(Feuil).Cells(7, Col_d) * 1 < Date_RDV
Col_d = Col_d + 1
Loop
Set Lig_h = Sheets(Feuil).Columns(1).Find(Heure_RDV)
Sheets(Feuil).Cells(Lig_h.Row, Col_d) = Soc
End Sub |
Partager