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
| Dim MaListe() As Variant, Tableau() As Variant
Private Sub UserForm_Initialize()
Dim s As Object
For Each s In ActiveWorkbook.Sheets
If s.Name <> "Parametres" And s.Name <> "Page" Then
Me.LBChoix.AddItem s.Name
End If
Next s
Me.LBChoix.ListIndex = -1
End Sub
Private Sub LBChoix_Change()
Dim i As Byte, sh As Worksheet, n As Byte
ReDim MaListe(0)
ReDim Tableau(0, 4)
With Me.LBChoix
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
MaListe(UBound(MaListe)) = fmChoixFeuille.LBChoix.List(i) & "!R8C21:R16C42"
ReDim Preserve MaListe(UBound(MaListe) + 1)
Tableau(UBound(Tableau), 0) = fmChoixFeuille.LBChoix.List(i) & "!R17C25"
Tableau(UBound(Tableau), 1) = fmChoixFeuille.LBChoix.List(i) & "!R17C33"
Tableau(UBound(Tableau), 2) = fmChoixFeuille.LBChoix.List(i) & "!R18C25"
Tableau(UBound(Tableau), 3) = fmChoixFeuille.LBChoix.List(i) & "!R18C33"
Tableau(UBound(Tableau), 4) = fmChoixFeuille.LBChoix.List(i) & "!R17C39"
ReDim Preserve Tableau((UBound(Tableau) + 1), 4)
End If
Next i
End With
End Sub
Private Sub CmdValid_Click()
ReDim Preserve MaListe(UBound(MaListe) - 1)
Sheets("Saisie (2)").Range("U8:AP16").Consolidate Sources:=MaListe(), Function:=xlSum, TopRow:=True, LeftColumn _
:=True, CreateLinks:=False
ReDim Preserve Tableau(UBound(Tableau), 4)
Sheets("saisie (2)").Range("Y17").Consolidate Sources:=Tableau(UBound(Tableau), 0), Function:=xlSum, TopRow:=True, LeftColumn _
:=True, CreateLinks:=False
End Sub
Private Sub CmdQuit_Click()
Unload Me
End Sub |
Partager