XL 2016 recherche find

Usine à gaz

XLDnaute Barbatruc
Bonjour à toutes et à tous,
Je vous souhaite un bon dimanche :)

Je butte sur 2 problèmes (pour moi LOL);

J'ai un petit code de recherche find qui fonctionne sans souci.

J'aimerais si cela est possible qu'à la fermeture de la recherche, la valeur cherchée soit effacée et qu'un message m'indique quand la recherche est terminée.

Malgré mes essais et recherches sur forums et sur le net je n'ai pas trouvé "mon bonheur".
Auriez-vous la solution ?
petit fichier joint

Je vous remercie déjà pour m'avoir lu.
amicalement,
arthour973
 

Pièces jointes

  • Recheche simple tous onglets.xlsm
    284.1 KB · Affichages: 12
Dernière édition:

youky(BJ)

XLDnaute Barbatruc
Bonjour Arthour,
Voici une solution.
Bruno

code sur tout le fichier
VB:
Sub Rechercher()
nom = InputBox("A rechercher", "Recherche")
If nom = "" Then Exit Sub
For k = 1 To Sheets.Count
With Sheets(k).UsedRange
Set c = .Find(nom, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Sheets(k).Select
c.Activate
rep = MsgBox("Continuer la recherche ?", 4 + 32, "S?lection")
If rep = vbNo Then Exit Sub
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Next
MsgBox "Recherche terminée!"
End Sub
code pour 1 page
VB:
Sub Rechercher()
nom = InputBox("A rechercher", "Recherche")
If nom = "" Then Exit Sub
With Sheets(1).UsedRange
Set c = .Find(nom, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Activate
rep = MsgBox("Continuer la recherche ?", 4 + 32, "Sélection")
If rep = vbNo Then Exit Sub
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
MsgBox "Recherche terminée!"
End Sub
 
Dernière édition:

Discussions similaires

Statistiques des forums

Discussions
314 017
Messages
2 104 582
Membres
109 082
dernier inscrit
Narlock