XL 2010 Ventes clients

hema300

XLDnaute Nouveau
Bonjour
pouvez-vous m'aider
Lors de la sélection d'un nom de client spécifique dans ComboBox1
Apporte la dernière valeur répertoriée dans la feuille à textbox1
 
Solution
VB:
Private Sub ComboBox1_Change()
Dim ws2 As Worksheet
    Set ws2 = Sheets("Sheet2")
    Dim lastrow As Long
    lastrow = ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row
    Dim i As Integer
    Dim foundValue As String
    TextBox1.Value = ""
    For i = 2 To lastrow
        If ws2.Cells(i, 1).Value = ComboBox1.Value Then
            foundValue = ws2.Cells(i, 2).Value
        End If
    Next i
    TextBox1.Value = foundValue
    End Sub

hema300

XLDnaute Nouveau
Screenshot_2023-12-19-16-27-42-09_99c04817c0de5652397fc8b56c3b3817.jpg
 

hema300

XLDnaute Nouveau
VB:
Private Sub ComboBox1_Change()
Dim ws2 As Worksheet
    Set ws2 = Sheets("Sheet2")
    Dim lastrow As Long
    lastrow = ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row
    Dim i As Integer
    Dim foundValue As String
    TextBox1.Value = ""
    For i = 2 To lastrow
        If ws2.Cells(i, 1).Value = ComboBox1.Value Then
            foundValue = ws2.Cells(i, 2).Value
        End If
    Next i
    TextBox1.Value = foundValue
    End Sub
 

Discussions similaires

Statistiques des forums

Discussions
314 628
Messages
2 111 337
Membres
111 104
dernier inscrit
JEMADA