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
|
Sub Formula()
Dim DerLig As Long
Dim AireBdd As Range
Dim ShBdd As Worksheet
Set ShBdd = Workbooks("TABLEAU_I.xlsx").Sheets("BDD_PT")
With ShBdd
DerLig = .Cells(.Rows.Count, 1).End(xlUp).Row
If DerLig = 1 Then Exit Sub
Set AireBdd = .Range(.Cells(2, 1), .Cells(DerLig, 1))
With AireBdd
.Offset(0, 1).Formula = "=IF(RC[1]>1,1,0)" ' Colonne B
.Offset(0, 10).Formula = "=YEAR(RC[2])" ' Colonne L
.Offset(0, 11).Formula = "=WEEKNUM(RC[1])" ' Colonne M
.Offset(0, 16).Formula = "=YEAR(RC[2])" ' Colonne Q
.Offset(0, 17).Formula = "=WEEKNUM(RC[1])" ' Colonne R
.Offset(0, 23).Formula = "=YEAR(RC[2])" ' Colonne X
.Offset(0, 24).Formula = "=WEEKNUM(RC[1])" ' Colonne Y
.Offset(0, 33).Formula = "=IF(RC[-1]>"""",1,0)" ' Colonne AH
.Offset(0, 39).Formula = "=+RC[-38]-RC[-6]" ' Colonne AN
.Offset(0, 40).Formula = "=+IF(RC[-1]>0,RC[-2],0)" ' Colonne AO
.Offset(0, 41).Formula = "=+IF(OR(RC[-15]=0,RC[-16]=0),"""",RC[-15]-RC[-16])" ' Colonne AP
.Offset(0, 42).Formula = "=+IF(OR(RC[-14]=0,RC[-16]=0),"""",RC[-14]-RC[-16])" ' Colonne AQ
.Offset(0, 43).Formula = "=+IF(AND(RC[-33]<>""EN COURS"",OR(MID(LEFT(RC[-37]),1,1)=""E"",MID(LEFT(RC[-37],5),1,5)=""JEU I""),TODAY()>RC[-23]-7),""URGENT"","""")" ' Colonne AR
End With
Set AireBdd = Nothing
End With
Set ShBdd = Nothing
End Sub |