Option Explicit
Option Base 1
'********************************************************************************************
'***********************AFFICHE LES ELEMENTS A L'OUVERTURE DU USERFORM***********************
'********************************************************************************************
Private Sub UserForm_Initialize()
Dim TABLO() As Variant, Curseur As Integer, n As Integer, Compteur As Integer
Curseur = ActiveCell.Row 'indique le numéro de la ligne où le curseur se situe
Compteur = 0
TextBoxNom.Value = Range("B" & Curseur)
TABLO = Range("A3:C18")
ReDim NewTABLO(1)
For n = LBound(TABLO, 1) To UBound(TABLO, 1)
If TABLO(n, 2) = TextBoxNom.Value Then
Compteur = Compteur + 1
Facture.Controls("TextBoxMarchePoste" & Compteur).Text = TABLO(n, 1)
Facture.Controls("TextBoxMarchePoste" & Compteur).Visible = True
Facture.Controls("TextBoxMarcheMontantHT" & Compteur).Text = TABLO(n, 3)
Facture.Controls("TextBoxMarcheMontantHT" & Compteur).Visible = True
End If
Next n
End Sub