Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim S As Worksheet
Dim SPS As Spreadsheet
Dim R As Range
Dim var
Dim T()
Dim i&
Dim j&
Dim cpt&
'---
Set SPS = Spreadsheet1
SPS.Cells.ClearContents
If ComboBox1 = "" Then Exit Sub
'--- Monte les données correspondantes dans un tableau ---
Set S = Sheets("DATA")
Set R = S.[a1].CurrentRegion
var = R
For i& = 1 To UBound(var, 1)
If UCase(ComboBox1) = UCase(var(i&, 1)) Then
cpt& = cpt& + 1
ReDim Preserve T(1 To UBound(var, 2), 1 To cpt&)
For j& = 1 To UBound(var, 2)
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
'°°° Exception : cas d'une date °°°
'°°° On force la date en string en ajoutant une quote ' °°°
If IsDate(var(i&, j&)) Then var(i&, j&) = "'" & var(i&, j&)
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
T(j&, cpt&) = var(i&, j&)
Next j&
End If
Next i&
'--- Inscrit les données trouvées dans le Spreadsheet ---
If cpt& = 0 Then Exit Sub
SPS.Range(SPS.Cells(1, 1), SPS.Cells(UBound(T, 2), UBound(T, 1))) = Application.WorksheetFunction.Transpose(T)
End Sub
Private Sub UserForm_Activate()
Dim S As Worksheet
'---
Set S = Sheets("PARAM")
ComboBox1.List = S.Range("A2:A" & S.Cells(Application.Rows.Count, 1).End(xlUp).Row).Value
End Sub