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
| ' on remplit le tableau du haut
i = 8
While ActiveSheet.Range("A" & i).Value <> "Total"
' récupération du nom de la direction
nomDir = ActiveSheet.Range("A" & i).Value
If nomDirTraitee = nomDir Then
ActiveSheet.Range("A" & i & ":C" & i).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Selection.Font.Bold = True
End If
Workbooks(2).Activate
ActiveWorkbook.Sheets(nomFeuille).Select
On Error GoTo -1: On Error GoTo finDir
ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields("Branche Direction").CurrentPage = nomDir
cout = ActiveSheet.Range("H8").Value
' on récupère le mois en cours (pas forcément dans la dernière colonne)
numCol = 14
While numCol >= 2
If ActiveSheet.Cells(12, numCol).Value <> "" Then
nbPrest = ActiveSheet.Cells(12, numCol).Value
numCol = 1
Else
numCol = numCol - 1
End If
Wend
' MAJ du tableau
Workbooks(3).Activate
ActiveWorkbook.Worksheets(Left(nomSociete, 31)).Select
If IsError(cout) Then
ActiveSheet.Rows(i).Delete
Else
ActiveSheet.Range("B" & i).Value = nbPrest
ActiveSheet.Range("C" & i).Value = cout
i = i + 1
End If
finDir:
Err.Number = 0
Wend |
Partager