Bonjour à tous,
Je suis à la recherche d'un USF avec une fonction recherche,
le tout pour améliore mon fichier.
En cherchant sur le forum j'ai fini par trouver celui-ci.
Il fonctionne bien pour l'instant mais il fait sa recherche sur toutes les feuilles de mon fichier
Or je voudrais qu'il cherche seulement sur une feuille
La feuille " trib "
Voici le code
Option Explicit
'
' Recherche d'une lettre ou d'un mot sur
' l'ensemble des feuilles
'
' Vériland Octobre 2003
' pour Lien supprimé
'
Private Sub CommandButton2_Click()
Feuil1.Activate
Unload Me
End Sub
Private Sub AfficheListe_Click()
Dim WS As Worksheet
Dim Plage As Range, Cell As Range
Dim Recherche As String, Adresse As String
Dim Ligne As Variant
Dim C As Object
Recherche = TextBox1
If Recherche = "" Then Exit Sub
For Each WS In Worksheets
Ligne = Worksheets(WS.Name).Range("" & "B" & "65536").End(xlUp).Row
Set Plage = Worksheets(WS.Name).Range("" & "B" & "4:" & "DL" & Ligne)
With Plage
Set C = .Find(Recherche)
If Not C Is Nothing Then
Adresse = C.Address
Do
ListBox1.AddItem C
ListBox2.AddItem C.Address
ListBox3.AddItem WS.Name
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> Adresse
End If
End With
Next WS
End Sub
Private Sub ListBox1_Click()
Dim i As Byte
Dim Feuille As String, Cellule As String
For i = 0 To ListBox1.ListCount
If ListBox1.Selected(i) = True Then
Cellule = ListBox2.List(i)
Feuille = ListBox3.List(i)
End If
Next i
Sheets(Feuille).Activate
Range(Cellule).Select
End Sub
Merci beaucoup de votre aide
Marcelio
Je suis à la recherche d'un USF avec une fonction recherche,
le tout pour améliore mon fichier.
En cherchant sur le forum j'ai fini par trouver celui-ci.
Il fonctionne bien pour l'instant mais il fait sa recherche sur toutes les feuilles de mon fichier
Or je voudrais qu'il cherche seulement sur une feuille
La feuille " trib "
Voici le code
Option Explicit
'
' Recherche d'une lettre ou d'un mot sur
' l'ensemble des feuilles
'
' Vériland Octobre 2003
' pour Lien supprimé
'
Private Sub CommandButton2_Click()
Feuil1.Activate
Unload Me
End Sub
Private Sub AfficheListe_Click()
Dim WS As Worksheet
Dim Plage As Range, Cell As Range
Dim Recherche As String, Adresse As String
Dim Ligne As Variant
Dim C As Object
Recherche = TextBox1
If Recherche = "" Then Exit Sub
For Each WS In Worksheets
Ligne = Worksheets(WS.Name).Range("" & "B" & "65536").End(xlUp).Row
Set Plage = Worksheets(WS.Name).Range("" & "B" & "4:" & "DL" & Ligne)
With Plage
Set C = .Find(Recherche)
If Not C Is Nothing Then
Adresse = C.Address
Do
ListBox1.AddItem C
ListBox2.AddItem C.Address
ListBox3.AddItem WS.Name
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> Adresse
End If
End With
Next WS
End Sub
Private Sub ListBox1_Click()
Dim i As Byte
Dim Feuille As String, Cellule As String
For i = 0 To ListBox1.ListCount
If ListBox1.Selected(i) = True Then
Cellule = ListBox2.List(i)
Feuille = ListBox3.List(i)
End If
Next i
Sheets(Feuille).Activate
Range(Cellule).Select
End Sub
Merci beaucoup de votre aide
Marcelio