Private Sub UserForm_Initialize()
'***********************
'COMMANDE CLIENT
'***********************
Application.ScreenUpdating = False
Usf_VisibleAjoutSolde = True
TxtDate = DateSerial(Year(Date), Month(Date), 1) - 1
Set f = Sheets("Comptes")
Set rng = f.Range("a2:j" & f.[a1000000].End(xlUp).Row) ' BD (1 colonne de plus)
colInterro = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ' colonnes à interroger (adapter)
colVisu = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ' colonnes à visualiser (adapter)
Decal = rng.Row - 1 ' début de la BD
BD = rng.Value
col = UBound(BD, 2): For i = LBound(BD) To UBound(BD): BD(i, col) = i + Decal: Next i 'no enreg
NcolInt = UBound(colInterro) + 1
Ncol = UBound(colVisu) + 1 ' : ReDim ancien(1 To 1, 1 To Ncol)
Me.LstSolde.ColumnCount = UBound(colVisu) + 1
Me.LstSolde.ColumnWidths = "0;60;100;90;100;80;0;0;80;0"
'-- génération de choix()
ReDim choix(1 To UBound(BD))
col = UBound(BD, 2)
For i = LBound(BD) To UBound(BD)
For Each K In colInterro
choix(i) = choix(i) & BD(i, K) & "|"
If IsDate(BD(i, K)) Then BD(i, K) = Format(BD(i, K), "dd/mm/yyyy")
Next K
choix(i) = choix(i) & BD(i, col) & "|" ' no enreg
Next i
'--- valeurs initiales dans ListBox
Dim Tbl(): ReDim Tbl(1 To UBound(BD), 1 To Ncol + 1)
For i = 1 To UBound(BD)
If CDate(TxtDate) <> CDate(Tbl(i, 9)) Then '
C = 0
For Each K In colVisu
C = C + 1: Tbl(i, C) = BD(i, K)
Next K
C = C + 1: Tbl(i, C) = i + Decal
End If '
Next i
Me.LstSolde.List = Tbl
TExtboxRech_Change
Me.LstSolde.ListIndex = -1
TxtComptable.Value = Sheets("Données").Range("a2")
Application.ScreenUpdating = True
End Sub