Lorsqu'on utilise Find dans une macro Excel, il trouve un élément
contenant la recherche.
Y a-t-il un moyen qu'il trouve immédiatement la totalité de la question
et non une partie.
Exemple: Je cherche "Pierre" et il me sort "Pierrette".
J'aimerai trouver "Pierre" tout de suite.
Merci pour un tuyeau.
Pierre
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
MichDenis
La méthode Find a des options :
En VBA, il y a le paramètre LookAt que tu dois utiliser avec la valeur XlWhole
À partir de la commande Edition / rechercher / si tu cliques sur le bouton Options, tu peux définir le même paramètre en cochant "totalité du contenu dans la cellule"
Je t'invite à lire fortement et plus d'une fois l'aide qu'excel a mis à l'intention des usagers.
"P. de Candolle" a écrit dans le message de news:
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément contenant la recherche. Y a-t-il un moyen qu'il trouve immédiatement la totalité de la question et non une partie. Exemple: Je cherche "Pierre" et il me sort "Pierrette". J'aimerai trouver "Pierre" tout de suite. Merci pour un tuyeau. Pierre
La méthode Find a des options :
En VBA, il y a le paramètre LookAt que tu dois utiliser avec la valeur XlWhole
À partir de la commande Edition / rechercher / si tu cliques sur le bouton
Options, tu peux définir le même paramètre en cochant
"totalité du contenu dans la cellule"
Je t'invite à lire fortement et plus d'une fois l'aide qu'excel a mis à
l'intention des usagers.
"P. de Candolle" <pierredecandolle@bluewin.ch> a écrit dans le message de news:
47b30de7@news.vsnet.ch...
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément
contenant la recherche.
Y a-t-il un moyen qu'il trouve immédiatement la totalité de la question
et non une partie.
Exemple: Je cherche "Pierre" et il me sort "Pierrette".
J'aimerai trouver "Pierre" tout de suite.
Merci pour un tuyeau.
Pierre
En VBA, il y a le paramètre LookAt que tu dois utiliser avec la valeur XlWhole
À partir de la commande Edition / rechercher / si tu cliques sur le bouton Options, tu peux définir le même paramètre en cochant "totalité du contenu dans la cellule"
Je t'invite à lire fortement et plus d'une fois l'aide qu'excel a mis à l'intention des usagers.
"P. de Candolle" a écrit dans le message de news:
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément contenant la recherche. Y a-t-il un moyen qu'il trouve immédiatement la totalité de la question et non une partie. Exemple: Je cherche "Pierre" et il me sort "Pierrette". J'aimerai trouver "Pierre" tout de suite. Merci pour un tuyeau. Pierre
JB
Bonjour,
http://cjoint.com/?cnrCvHnQti
SubChercheMotEntier() [a:a].Interior.ColorIndex = xlNone mot = InputBox("Mot cherché? ") If mot = "" Then Exit Sub Set r = [a:a].Find(What:=mot, LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:="* " & mot, LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:=mot & " *", LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:="* " & mot & " *", LookAt:=xlWhole) If Not r Is Nothing Then colorie r End Sub
Sub colorie(r) premier = r.Address Do r.Interior.ColorIndex = 4 Set r = [a:a].FindNext(r) Loop While Not r Is Nothing And r.Address <> premier End Sub
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément contenant la recherche. Y a-t-il un moyen qu'il trouve immédiatement la totalité de la questio n et non une partie. Exemple: Je cherche "Pierre" et il me sort "Pierrette". J'aimerai trouver "Pierre" tout de suite. Merci pour un tuyeau. Pierre
Bonjour,
http://cjoint.com/?cnrCvHnQti
SubChercheMotEntier()
[a:a].Interior.ColorIndex = xlNone
mot = InputBox("Mot cherché? ")
If mot = "" Then Exit Sub
Set r = [a:a].Find(What:=mot, LookAt:=xlWhole)
If Not r Is Nothing Then colorie r
Set r = [a:a].Find(What:="* " & mot, LookAt:=xlWhole)
If Not r Is Nothing Then colorie r
Set r = [a:a].Find(What:=mot & " *", LookAt:=xlWhole)
If Not r Is Nothing Then colorie r
Set r = [a:a].Find(What:="* " & mot & " *", LookAt:=xlWhole)
If Not r Is Nothing Then colorie r
End Sub
Sub colorie(r)
premier = r.Address
Do
r.Interior.ColorIndex = 4
Set r = [a:a].FindNext(r)
Loop While Not r Is Nothing And r.Address <> premier
End Sub
On 13 fév, 16:29, "P. de Candolle" <pierredecando...@bluewin.ch>
wrote:
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément
contenant la recherche.
Y a-t-il un moyen qu'il trouve immédiatement la totalité de la questio n
et non une partie.
Exemple: Je cherche "Pierre" et il me sort "Pierrette".
J'aimerai trouver "Pierre" tout de suite.
Merci pour un tuyeau.
Pierre
SubChercheMotEntier() [a:a].Interior.ColorIndex = xlNone mot = InputBox("Mot cherché? ") If mot = "" Then Exit Sub Set r = [a:a].Find(What:=mot, LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:="* " & mot, LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:=mot & " *", LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:="* " & mot & " *", LookAt:=xlWhole) If Not r Is Nothing Then colorie r End Sub
Sub colorie(r) premier = r.Address Do r.Interior.ColorIndex = 4 Set r = [a:a].FindNext(r) Loop While Not r Is Nothing And r.Address <> premier End Sub
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément contenant la recherche. Y a-t-il un moyen qu'il trouve immédiatement la totalité de la questio n et non une partie. Exemple: Je cherche "Pierre" et il me sort "Pierrette". J'aimerai trouver "Pierre" tout de suite. Merci pour un tuyeau. Pierre
JB
Mot entier seulement:
Sub MotEntier() [a:a].Interior.ColorIndex = xlNone mot = InputBox("Mot cherché? ") If mot = "" Then Exit Sub Set r = [a:a].Find(What:=mot, LookAt:=xlWhole) If Not r Is Nothing Then premier = r.Address Do r.Interior.ColorIndex = 4 Set r = [a:a].FindNext(r) Loop While Not r Is Nothing And r.Address <> premier End If End Sub
Mot entier dans un paragraphe:
Sub MotEntierTexte() [a:a].Interior.ColorIndex = xlNone mot = InputBox("Mot cherché? ") If mot = "" Then Exit Sub Set r = [a:a].Find(What:=mot, LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:="* " & mot, LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:=mot & " *", LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:="* " & mot & " *", LookAt:=xlWhole) If Not r Is Nothing Then colorie r End Sub
Sub colorie(r) premier = r.Address Do r.Interior.ColorIndex = 4 Set r = [a:a].FindNext(r) Loop While Not r Is Nothing And r.Address <> premier End Sub
JB
On 13 fév, 16:29, "P. de Candolle" wrote:
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément contenant la recherche. Y a-t-il un moyen qu'il trouve immédiatement la totalité de la questio n et non une partie. Exemple: Je cherche "Pierre" et il me sort "Pierrette". J'aimerai trouver "Pierre" tout de suite. Merci pour un tuyeau. Pierre
Mot entier seulement:
Sub MotEntier()
[a:a].Interior.ColorIndex = xlNone
mot = InputBox("Mot cherché? ")
If mot = "" Then Exit Sub
Set r = [a:a].Find(What:=mot, LookAt:=xlWhole)
If Not r Is Nothing Then
premier = r.Address
Do
r.Interior.ColorIndex = 4
Set r = [a:a].FindNext(r)
Loop While Not r Is Nothing And r.Address <> premier
End If
End Sub
Mot entier dans un paragraphe:
Sub MotEntierTexte()
[a:a].Interior.ColorIndex = xlNone
mot = InputBox("Mot cherché? ")
If mot = "" Then Exit Sub
Set r = [a:a].Find(What:=mot, LookAt:=xlWhole)
If Not r Is Nothing Then colorie r
Set r = [a:a].Find(What:="* " & mot, LookAt:=xlWhole)
If Not r Is Nothing Then colorie r
Set r = [a:a].Find(What:=mot & " *", LookAt:=xlWhole)
If Not r Is Nothing Then colorie r
Set r = [a:a].Find(What:="* " & mot & " *", LookAt:=xlWhole)
If Not r Is Nothing Then colorie r
End Sub
Sub colorie(r)
premier = r.Address
Do
r.Interior.ColorIndex = 4
Set r = [a:a].FindNext(r)
Loop While Not r Is Nothing And r.Address <> premier
End Sub
JB
On 13 fév, 16:29, "P. de Candolle" <pierredecando...@bluewin.ch>
wrote:
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément
contenant la recherche.
Y a-t-il un moyen qu'il trouve immédiatement la totalité de la questio n
et non une partie.
Exemple: Je cherche "Pierre" et il me sort "Pierrette".
J'aimerai trouver "Pierre" tout de suite.
Merci pour un tuyeau.
Pierre
Sub MotEntier() [a:a].Interior.ColorIndex = xlNone mot = InputBox("Mot cherché? ") If mot = "" Then Exit Sub Set r = [a:a].Find(What:=mot, LookAt:=xlWhole) If Not r Is Nothing Then premier = r.Address Do r.Interior.ColorIndex = 4 Set r = [a:a].FindNext(r) Loop While Not r Is Nothing And r.Address <> premier End If End Sub
Mot entier dans un paragraphe:
Sub MotEntierTexte() [a:a].Interior.ColorIndex = xlNone mot = InputBox("Mot cherché? ") If mot = "" Then Exit Sub Set r = [a:a].Find(What:=mot, LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:="* " & mot, LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:=mot & " *", LookAt:=xlWhole) If Not r Is Nothing Then colorie r Set r = [a:a].Find(What:="* " & mot & " *", LookAt:=xlWhole) If Not r Is Nothing Then colorie r End Sub
Sub colorie(r) premier = r.Address Do r.Interior.ColorIndex = 4 Set r = [a:a].FindNext(r) Loop While Not r Is Nothing And r.Address <> premier End Sub
JB
On 13 fév, 16:29, "P. de Candolle" wrote:
Lorsqu'on utilise Find dans une macro Excel, il trouve un élément contenant la recherche. Y a-t-il un moyen qu'il trouve immédiatement la totalité de la questio n et non une partie. Exemple: Je cherche "Pierre" et il me sort "Pierrette". J'aimerai trouver "Pierre" tout de suite. Merci pour un tuyeau. Pierre