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
| Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ER
Application.EnableEvents = False
If Target.Column = 1 And Target.Count = 1 Then
If Target.Value = "" Then
Target.Resize(1, 13).Clear
Else
'---------------------------------------------- =SI(a6<>"";"Cotisations encaissées";"")" -------------------------------------------
Target.Offset(0, 1) = "Cotisations encaissées"
'---------------------------------------------'=SI(a7<>"";C6+1;"")
Target.Offset(0, 2).FormulaR1C1 = "=IF(RC[-2]="""","""",R[-1]C+1)"
'----------------------------------------------'=SI(a6<>"";"Cotisation";"")-----------------------------------------------------------
Target.Offset(0, 3) = "Cotisations"
'------------'=SI(H6="ok";$H$3+0;SI(I6="ok";$I$3+0;SI(J6="ok";$J$3+0;SI(K6="ok";$K$3+0;SI(L6="ok";$L$3+0;SI(M6="ok";$M$3+0;""))))))----
With Target.Offset(0, 6)
.FormulaR1C1 = "=IF(RC[1]=""OK"",R3C8,IF(RC[2]=""OK"",R3C9,IF(RC[3]=""OK"",R3C10,IF(RC[4]=""OK"",R3C11,IF(RC[5]=""OK"",R3C12,IF(RC[6]=""OK"",R3C13,""""))))))"
' ---'couleur orange
.Interior.ColorIndex = 45
End With
'---'couleur jaune
Target.Offset(0, 7).Resize(1, 3).Interior.ColorIndex = 6
'---'couleur gris
Target.Offset(0, 10).Resize(1, 3).Interior.ColorIndex = 48
'quadrillage
With Target.Resize(1, 13).Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
End If
End If
ER:
Application.EnableEvents = True
End Sub |
Partager