Public Function RecupDonnees()
Dim WkB_Cible As Workbook
Dim TabTemp() As Variant
Dim Lgn As Long, Col As Long
' Chemin d'accès complet du fichier source
Dim Chemin As String
Dim Ok_Found As Boolean
Chemin = ThisWorkbook.Path & "\Totaux.xlsm"
Application.ScreenUpdating = False
' Ouvrir le fichier source en tant que workbook
Set WkB_Cible = Workbooks.Open(Chemin)
Ok_Found = False
'On récupére la plage de données du tableau
TabTemp = WkB_Cible.Worksheets("Total sections").Range("E6").CurrentRegion.Value ' Range("t_Totaux").ListObject.DataBodyRange.Value
' Fermer le fichier source sans enregistrer
WkB_Cible.Close False
For Lgn = 1 To UBound(TabTemp, 1)
If TabTemp(Lgn, 1) = Date Then
With UserForm1
.TBx_A = TabTemp(Lgn, 2)
.TBx_B = TabTemp(Lgn, 3)
.TBx_C = TabTemp(Lgn, 4)
.TBx_D = TabTemp(Lgn, 5)
Ok_Found = True
End With
End If
If Ok_Found = True Then Exit For
Next Lgn
Application.ScreenUpdating = True
End Function