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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
| Sub Agglo()
'On sélectionne la colonne DI du document sur les critéres
Windows("indicateur_fuites.xls").Activate
Dim Cell As Range
Dim Ligne1 As Integer
Dim Ligne2 As Integer
Dim debtab As Range
Dim fintab As Range
Dim finext As Range
Dim finagg As Range
Dim fina As Range
Dim fincri As Range
Dim tabcriteres As Range
Dim i As Integer
'On sélectionne la colonne DI du document extraction
Worksheets("Critere").Activate:(
Ligne1 = Worksheets("Critere").UsedRange.Rows.Count
Worksheets("Extraction").Activate
Ligne2 = Worksheets("Extraction").UsedRange.Rows.Count
finext = Worksheets("Extraction").Cell(Ligne2, 13)
Range(A2, finext).Copy
'On colle dans la feuille Agglomération
finagg = Worksheets("Agglomeration").Cell(Ligne2 + 1, 13)
ActiveSheet.Paste Destination:=Sheets("Agglomeration").Range("A3:finagg")
'On compare les DI et on colle les informations à la suite
debtab = Worksheets("Critere").Cells(1, 1)
fintab = Worksheets("Critere").Cells(Ligne1, 10)
tabcriteres = Worksheets("Critere").Range(debtab, fintab)
For i = 2 To Ligne2
Cell(i, 14) = "=VLOOKUP(Cell(i,1),tabcriteres,2)" 'Gravité
Cell(i, 15) = "=VLOOKUP(Cell(i,1),tabcriteres,3)" 'Catégorie
Cell(i, 16) = "=VLOOKUP(Cell(i,1),tabcriteres,4)" 'Priorisation
Cell(i, 17) = "=VLOOKUP(Cell(i,1),tabcriteres,5)" 'Poids
Cell(i, 18) = "=VLOOKUP(Cell(i,1),tabcriteres,6)" 'Age
Cell(i, 19) = "=VLOOKUP(Cell(i,1),tabcriteres,7)" 'Poids des ans
Cell(i, 20) = "=VLOOKUP(Cell(i,1),tabcriteres,8)" 'Score
Cell(i, 21) = "=VLOOKUP(Cell(i,1),tabcriteres,9)" 'Prévue le
i = i + 1
Next
'On copie les colonnes pour les remettre dans la feuille critére
Worksheets("Agglomeration").Column(A).Copy
Worksheets("Criteres").Activate
ActiveSheet.Paste Destination:=Sheets("Criteres").Column(A)
fina = Worksheets("Agglomeration").Cell(Ligne2, 21)
Worksheets("Agglomeration").Range(N1, fina).Copy
Worksheets("Criteres").Activate
fincri = Worksheets("Criteres").Cell(Ligne2, 9)
ActiveSheet.Paste Destination:=Sheets("Criteres").Range(B1, fincri)
'Titre des colonnes du document d'agglomération
Worksheets("Agglomeration").Activate
Cells(1, 1) = "N°DI"
Cells(1, 2) = "N°Tranche"
Cells(1, 3) = "Système"
Cells(1, 4) = "N° PF"
Cells(1, 5) = "Bigramme"
Cells(1, 6) = "Libellé"
Cells(1, 7) = "AT/TEF"
Cells(1, 8) = "Arrêt?"
Cells(1, 9) = "Priorité"
Cells(1, 10) = "Etat"
Cells(1, 11) = "Date dernière MAJ"
Cells(1, 12) = "Date émission"
Cells(1, 13) = "Date prévue"
Cells(1, 14) = "Gravité"
Cells(1, 15) = "Catégorie"
Cells(1, 16) = "Priorisation"
Cells(1, 17) = "Poids"
Cells(1, 18) = "Age"
Cells(1, 19) = "Poids des ans"
Cells(1, 20) = "Score"
Cells(1, 21) = "prévue le"
'Dimensionnement des cellules
Columns(1).AutoFit
Columns(2).AutoFit
Columns(3).AutoFit
Columns(4).AutoFit
Columns(5).AutoFit
Columns(6).AutoFit
Columns(7).AutoFit
Columns(8).AutoFit
Columns(9).AutoFit
Columns(10).AutoFit
Columns(11).AutoFit
Columns(12).AutoFit
Columns(13).AutoFit
Columns(14).AutoFit
Columns(15).AutoFit
Columns(16).AutoFit
Columns(17).AutoFit
Columns(18).AutoFit
Columns(19).AutoFit
Columns(20).AutoFit
Columns(21).AutoFit
End Sub |
Partager