Combobox sur 2 feuilles

Bonjour à tous,

J'ai un petit soucis avec une combobox........

En faite je voudrais savoir s'il est possible de faire une recherche avec une combobox qui se trouve dans un userform sur deux feuilles

en gros dans la feuille 1 j'ai des données que je souhaite retrouver dans des textbox situés dans l'userform et pareil dans la feuille 2 est ce que cela est possible? je pensais un truc du genre.....

Dim cell As Range
Public le As Integer
Public li As Integer

Private Sub ComboBox1_Change()

Dim cherch As String, derlign As Long

derlign = Sheets("Etudes").Range("B500").End(xlUp).Row
idem = Sheets("INFORMATION_GÉNÉRAL").Range("C500").End(xlUp).Row

cherch = ComboBox1

le = Sheets("Etudes").Range("B5:B" & derlign).Find(cherch, LookIn:=xlValues, LookAt:= _
        xlWhole, SearchOrder:=xlByRows, MatchCase:=False).Row

li = Sheets("INFORMATION_GÉNÉRAL").Range("C5:C" & idem).Find(cherch, LookIn:=xlValues, LookAt:= _
        xlWhole, SearchOrder:=xlByRows, MatchCase:=False).Row

            TextBox1.Value = Cells(le, 4)
            TextBox2.Value = Cells(le, 7)
            TextBox3.Value = Cells(le, 8)
            TextBox4.Value = Cells(le, 9)
            TextBox5.Value = Cells(le, 10)
            TextBox6.Value = Cells(le, 14)

        With Sheets("INFORMATION_GÉNÉRAL")

            TextBox7.Value = Cells(li, 8)
            TextBox8.Value = Cells(li, 9)
            TextBox9.Value = Cells(li, 11)

End With

End Sub

Mais cela ne fonctionne pas et je n'en suis pas vraiment étonné ^^'

mais si quelqu’un pouvais m'aider sa serais super merci.

Bonjour,

Ton code épuré :

Private Sub ComboBox1_Change()
Dim le As Integer, li As Integer
    With Sheets("Etudes")
        le = .Range("B5", .Range("B500").End(xlUp)).Find(ComboBox1.Value, LookIn:=xlValues, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False).Row
        TextBox1.Value = .Cells(le, 4)
        TextBox2.Value = .Cells(le, 7)
        TextBox3.Value = .Cells(le, 8)
        TextBox4.Value = .Cells(le, 9)
        TextBox5.Value = .Cells(le, 10)
        TextBox6.Value = .Cells(le, 14)
    End With
    With Sheets("INFORMATION_GÉNÉRAL")
        li = .Range("C5", .Range("C500").End(xlUp)).Find(ComboBox1.Value, LookIn:=xlValues, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False).Row
        TextBox7.Value = .Cells(li, 8)
        TextBox8.Value = .Cells(li, 9)
        TextBox9.Value = .Cells(li, 11)
    End With
End Sub

A+

Rechercher des sujets similaires à "combobox feuilles"