1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("E2:F1500")) Is Nothing Then
Dim ligne As Integer
With ActiveCell
ligne = .Row
End With
If Cells(ligne, 4).Value Like "DAUNAT" Then
If Cells(ligne, 12) < 0 Then
Application.EnableEvents = False
Cells(ligne + 1, 4).FormulaR1C1 = "TVA"
Cells(ligne + 1, 6).FormulaR1C1 = "=ROUND(R[-1]C[-1]/1.055*0.055,2)"
Cells(ligne + 2, 4).FormulaR1C1 = "SANDWICH"
Cells(ligne + 2, 6).FormulaR1C1 = "=R[-2]C[-1]-R[-1]C"
Application.EnableEvents = True
Cells(ligne + 3, 1).Select
Else
Application.EnableEvents = False
Cells(ligne + 1, 4).FormulaR1C1 = "TVA"
Cells(ligne + 1, 5).FormulaR1C1 = "=ROUND(R[-1]C[1]/1.055*0.055,2)"
Cells(ligne + 2, 4).FormulaR1C1 = "SANDWICH"
Cells(ligne + 2, 5).FormulaR1C1 = "=R[-2]C[1]-R[-1]C"
Application.EnableEvents = True
Cells(ligne + 3, 1).Select
End If
Else
If Cells(ligne, 4).Value Like "MIKO" Then
If Cells(ligne, 12) < 0 Then
Application.EnableEvents = False
Cells(ligne + 1, 4).FormulaR1C1 = "TVA"
Cells(ligne + 1, 6).FormulaR1C1 = "=ROUND(R[-1]C[-1]/1.055*0.055,2)"
Cells(ligne + 2, 4).FormulaR1C1 = "ICE CREAM"
Cells(ligne + 2, 6).FormulaR1C1 = "=R[-2]C[-1]-R[-1]C"
Application.EnableEvents = True
Cells(ligne + 3, 1).Select
Else
Application.EnableEvents = False
Cells(ligne + 1, 4).FormulaR1C1 = "TVA"
Cells(ligne + 1, 5).FormulaR1C1 = "=ROUND(R[-1]C[1]/1.055*0.055,2)"
Cells(ligne + 2, 4).FormulaR1C1 = "ICE CREAM"
Cells(ligne + 2, 5).FormulaR1C1 = "=R[-2]C[1]-R[-1]C"
Application.EnableEvents = True
Cells(ligne + 3, 1).Select
End If |