Private Sub UserForm_Initialize()
With Sheets("Feuil1")
For i = 7 To .Range("G65000").End(xlUp).Row '7 pour la septième ligne
If .Cells(i, 7) <> .Cells(i - 1, 7) Then '7 pour la septième colonne (G)
TxtPriXAchat.AddItem .Cells(i, 7).Value
End If
Next
For i = 7 To .Range("H65000").End(xlUp).Row '7 pour la septième ligne
If .Cells(i, 8) <> .Cells(i - 1, 8) Then '8 pour la huitième colonne (H)
TxtPrixVente.AddItem .Cells(i, 8).Value
End If
Next
End With
End Sub
Private Sub TxtPriXAchat_Change()
Dim Ligne As Integer
If TxtPriXAchat <> "" Then
Ligne = TxtPriXAchat.ListIndex + 7 '7 pour la septième ligne
TxtPrixVente.Value = Range("H" & Ligne).Value
TxtMarge.Value = Range("I" & Ligne).Text
End If
End Sub
Private Sub TxtPrixVente_Change()
Dim Ligne As Integer
If TxtPrixVente <> "" Then
Ligne = TxtPrixVente.ListIndex + 7 '7 pour la septième ligne
TxtPriXAchat.Value = Range("G" & Ligne).Value
TxtMarge.Value = Range("I" & Ligne).Text
End If
End Sub