Re : fonction .find renvoie à la derniere recherche
Désolé, voici le code:
Private Sub UserForm_Initialize()
Dim Plage As Range
With Sheets("Liste entreprises")
Set Plage = .Range("I3:I" & .Range("I65536").End(xlUp).Row)
End With
ComboBox1.List = Plage.Value
End Sub
Private Sub CommandButton1_Click() 'bouton pour afficher des infos dans une msgbox
Sheets("Liste entreprises").Select
Dim trouve As Range, mavaleur As String
With Sheets("Liste entreprises").Range("I3:I" & Range("I65536").End(xlUp).Row)
Set trouve = .Find(what:=ComboBox1.Value, LookIn:=xlValues)
End With
If Not trouve Is Nothing Then
MsgBox "Enseigne :" & Cells(trouve.Row, trouve.Column).Text & Chr(13) & "Responsable: " & Cells(trouve.Row, 10).Text & Chr(13) & "Fonction: " & Cells(trouve.Row, 11).Text & Chr(13) & "Adresse: " & Cells(trouve.Row, 13).Text & " " & Cells(trouve.Row, 14).Text & Chr(13) & "ZA : " & Cells(trouve.Row, 12).Text & Chr(13) & "Code Postal: " & Cells(trouve.Row, 16).Value & Chr(13) & "Commune : " & Cells(trouve.Row, 17) & Chr(13) & "Téléphone : " & Cells(trouve.Row, 18).Text & Chr(13) & "Fax : " & Cells(trouve.Row, 19).Text & Chr(13) & "Mobile : " & Cells(trouve.Row, 20).Text & Chr(13) & "Courriel : " & Cells(trouve.Row, 21).Text & Chr(13) & "Site internet : " & Cells(trouve.Row, 22).Text & Chr(13) & "Numéro Siret : " & Cells(trouve.Row, 29)
End If
End Sub
Private Sub CommandButton2_Click()
'Ca c'est pour me renvoyer à la ligne de la selection
Dim trouve As Range
With Sheets("Liste entreprises").Range("I3:I" & Range("I65536").End(xlUp).Row)
Set trouve = .Find(what:=ComboBox1.Value, LookIn:=xlValues)
End With
If Not trouve Is Nothing Then
Sheets("Liste entreprises").Activate
Rows(trouve.Row).Select
UserForm1.Hide
End If
End Sub