Sub mise_a_jour_bilan()
Dim wbGRE As Workbook, wsPlan As Worksheet, chemin As String, nomipp1 As String, nomipp2 As String, nomipp3 As String, nomipp4 As String, nomipp5 As String, nomipp6 As String, nomipp7 As String, nomipp8 As String, nomipp9 As String, nomipp10 As String, nomipp11 As String, nomipp12 As String, nomipp13 As String, nomipp14 As String, nomipp15 As String, nomipp16 As String, nomipp17 As String, nomipp18 As String, nomipp19 As String, nomipp20 As String, nomipp21 As String, nomipp22 As String
Set wbGRE = ThisWorkbook
Set wsPlan = wbGRE.Worksheets("Plan de surveillance")
chemin = Workbooks(ActiveWorkbook.Name).Path
If wbGRE.wbPlan.Range(C2) <> "" Then
Set nomipp1 = wbGRE.wsPlan.Range(C2) + wbGRE.wsPlanRange(D2)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp1 + ".xlsx"
Set wbipp1 = ThisWorkbook
wbipp1.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U2")
wbipp1.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V2")
wbipp1.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W2")
End If
If wbGRE.wbPlan.Range(C3) <> "" Then
Set nomipp2 = wbGRE.wsPlan.Range(C3) + wbGRE.wsPlanRange(D3)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp2 + ".xlsx"
Set wbipp2 = ThisWorkbook
wbipp2.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U3")
wbipp2.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V3")
wbipp2.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W3")
End If
If wbGRE.wbPlan.Range(C4) <> "" Then
Set nomipp3 = wbGRE.wsPlan.Range(C4) + wbGRE.wsPlanRange(D4)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp3 + ".xlsx"
Set wbipp3 = ThisWorkbook
wbipp3.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U4")
wbipp3.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V4")
wbipp3.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W4")
End If
If wbGRE.wbPlan.Range(C5) <> "" Then
Set nomipp4 = wbGRE.wsPlan.Range(C5) + wbGRE.wsPlanRange(D5)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp4 + ".xlsx"
Set wbipp4 = ThisWorkbook
wbipp4.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U5")
wbipp4.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V5")
wbipp4.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W5")
End If
If wbGRE.wbPlan.Range(C6) <> "" Then
Set nomipp5 = wbGRE.wsPlan.Range(C6) + wbGRE.wsPlanRange(D6)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp5 + ".xlsx"
Set wbipp5 = ThisWorkbook
wbipp5.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U6")
wbipp5.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V6")
wbipp5.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W6")
End If
If wbGRE.wbPlan.Range(C7) <> "" Then
Set nomipp6 = wbGRE.wsPlan.Range(C7) + wbGRE.wsPlanRange(D7)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp6 + ".xlsx"
Set wbipp6 = ThisWorkbook
wbipp6.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U7")
wbipp6.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V7")
wbipp6.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W7")
End If
If wbGRE.wbPlan.Range(C8) <> "" Then
Set nomipp7 = wbGRE.wsPlan.Range(C8) + wbGRE.wsPlanRange(D8)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp7 + ".xlsx"
Set wbipp7 = ThisWorkbook
wbipp7.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U8")
wbipp7.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V8")
wbipp7.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W8")
End If
If wbGRE.wbPlan.Range(C9) <> "" Then
Set nomipp8 = wbGRE.wsPlan.Range(C9) + wbGRE.wsPlanRange(D9)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp8 + ".xlsx"
Set wbipp8 = ThisWorkbook
wbipp8.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U9")
wbipp8.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V9")
wbipp8.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W9")
End If
If wbGRE.wbPlan.Range(C10) <> "" Then
Set nomipp9 = wbGRE.wsPlan.Range(C10) + wbGRE.wsPlanRange(D10)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp9 + ".xlsx"
Set wbipp9 = ThisWorkbook
wbipp9.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U10")
wbipp9.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V10")
wbipp9.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W10")
End If
If wbGRE.wbPlan.Range(C11) <> "" Then
Set nomipp10 = wbGRE.wsPlan.Range(C11) + wbGRE.wsPlanRange(D11)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp10 + ".xlsx"
Set wbipp10 = ThisWorkbook
wbipp10.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U11")
wbipp10.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V11")
wbipp10.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W11")
End If
If wbGRE.wbPlan.Range(C12) <> "" Then
Set nomipp11 = wbGRE.wsPlan.Range(C12) + wbGRE.wsPlanRange(D12)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp11 + ".xlsx"
Set wbipp11 = ThisWorkbook
wbipp11.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U12")
wbipp11.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V12")
wbipp11.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W12")
End If
If wbGRE.wbPlan.Range(C13) <> "" Then
Set nomipp12 = wbGRE.wsPlan.Range(C2) + wbGRE.wsPlanRange(D2)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp12 + ".xlsx"
Set wbipp12 = ThisWorkbook
wbipp12.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U13")
wbipp12.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V13")
wbipp12.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W13")
End If
If wbGRE.wbPlan.Range(C14) <> "" Then
Set nomipp13 = wbGRE.wsPlan.Range(C14) + wbGRE.wsPlanRange(D14)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp13 + ".xlsx"
Set wbipp13 = ThisWorkbook
wbipp13.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U14")
wbipp13.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V14")
wbipp13.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W14")
End If
If wbGRE.wbPlan.Range(C15) <> "" Then
Set nomipp14 = wbGRE.wsPlan.Range(C15) + wbGRE.wsPlanRange(D15)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp14 + ".xlsx"
Set wbipp14 = ThisWorkbook
wbipp14.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U15")
wbipp14.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V15")
wbipp14.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W15")
End If
If wbGRE.wbPlan.Range(C16) <> "" Then
Set nomipp15 = wbGRE.wsPlan.Range(C16) + wbGRE.wsPlanRange(D16)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp15 + ".xlsx"
Set wbipp15 = ThisWorkbook
wbipp15.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U16")
wbipp15.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V16")
wbipp15.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W16")
End If
If wbGRE.wbPlan.Range(C17) <> "" Then
Set nomipp16 = wbGRE.wsPlan.Range(C17) + wbGRE.wsPlanRange(D17)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp16 + ".xlsx"
Set wbipp16 = ThisWorkbook
wbipp16.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U17")
wbipp16.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V17")
wbipp16.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W17")
End If
If wbGRE.wbPlan.Range(C18) <> "" Then
Set nomipp17 = wbGRE.wsPlan.Range(C18) + wbGRE.wsPlanRange(D18)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp17 + ".xlsx"
Set wbipp17 = ThisWorkbook
wbipp17.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U18")
wbipp17.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V18")
wbipp17.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W18")
End If
If wbGRE.wbPlan.Range(C19) <> "" Then
Set nomipp18 = wbGRE.wsPlan.Range(C19) + wbGRE.wsPlanRange(D19)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp18 + ".xlsx"
Set wbipp18 = ThisWorkbook
wbipp18.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U19")
wbipp18.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V19")
wbipp18.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W19")
End If
If wbGRE.wbPlan.Range(C20) <> "" Then
Set nomipp19 = wbGRE.wsPlan.Range(C20) + wbGRE.wsPlanRange(D20)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp19 + ".xlsx"
Set wbipp19 = ThisWorkbook
wbipp19.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U20")
wbipp19.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V20")
wbipp19.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W20")
End If
If wbGRE.wbPlan.Range(C21) <> "" Then
Set nomipp20 = wbGRE.wsPlan.Range(C21) + wbGRE.wsPlanRange(D21)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp20 + ".xlsx"
Set wbipp20 = ThisWorkbook
wbipp20.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U21")
wbipp20.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V21")
wbipp20.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W21")
End If
If wbGRE.wbPlan.Range(C22) <> "" Then
Set nomipp21 = wbGRE.wsPlan.Range(C22) + wbGRE.wsPlanRange(D22)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp21 + ".xlsx"
Set wbipp21 = ThisWorkbook
wbipp21.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U22")
wbipp21.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V22")
wbipp21.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W22")
End If
If wbGRE.wbPlan.Range(C23) <> "" Then
Set nomipp22 = wbGRE.wsPlan.Range(C23) + wbGRE.wsPlanRange(D23)
Workbooks.Open Filename:=chemin + "/Suivi bilan/" + nomipp1 + ".xlsx"
Set wbipp22 = ThisWorkbook
wbipp22.Worksheets("Résumé").Range("B5").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("U23")
wbipp22.Worksheets("Résumé").Range("B7").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("V23")
wbipp22.Worksheets("Résumé").Range("B9").Copy
ActiveSheet.Paste Destination:=wbGRE.wsPlan.Range("W23")
End If
End Sub