Bonjour a tous,
Comment faire une recherche dichotomique sous excel.
Je voudrai pouvoir en tapant quelques lettres afficher la liste des clients
enregistrés et ensuite l'inserer dans une cellule.
Merci a tous
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
Jacky
Bonsoir, Si c'est pour une recherche Dichotomique ou autre d'ailleurs cela pourrait ressembler à ceci: '------------- Sub ChercheClient() Dim DerLi&, i&, Libre&, Mot$ Mot = InputBox("Client à chercher :") If Mot = "" Then Exit Sub DerLi = Cells(Rows.Count, "A").End(xlUp).Row For i = DerLi To 3 Step -1 If Application.CountIf _ (Range("A" & i & ":X" & i), "*" & Mot & "*") = 0 Then Range("A" & i).EntireRow.Hidden = True End If Next i If Cells(Rows.Count, "A").End(xlUp).Row = 1 Then Cells.EntireRow.Hidden = False MsgBox "'" & Mot & "' n'a pas été trouvé !" End If End Sub '---------------- Salutations JJ
"MsNewsMicrosoft.com" a écrit dans le message de news:
Bonjour a tous, Comment faire une recherche dichotomique sous excel. Je voudrai pouvoir en tapant quelques lettres afficher la liste des clients
enregistrés et ensuite l'inserer dans une cellule. Merci a tous
Bonsoir,
Si c'est pour une recherche Dichotomique ou autre d'ailleurs cela pourrait
ressembler à ceci:
'-------------
Sub ChercheClient()
Dim DerLi&, i&, Libre&, Mot$
Mot = InputBox("Client à chercher :")
If Mot = "" Then Exit Sub
DerLi = Cells(Rows.Count, "A").End(xlUp).Row
For i = DerLi To 3 Step -1
If Application.CountIf _
(Range("A" & i & ":X" & i), "*" & Mot & "*") = 0 Then
Range("A" & i).EntireRow.Hidden = True
End If
Next i
If Cells(Rows.Count, "A").End(xlUp).Row = 1 Then
Cells.EntireRow.Hidden = False
MsgBox "'" & Mot & "' n'a pas été trouvé !"
End If
End Sub
'----------------
Salutations
JJ
"MsNewsMicrosoft.com" <jeanmarcfaucon@voila.fr> a écrit dans le message de
news:eiHeptvTEHA.332@TK2MSFTNGP11.phx.gbl...
Bonjour a tous,
Comment faire une recherche dichotomique sous excel.
Je voudrai pouvoir en tapant quelques lettres afficher la liste des
clients
enregistrés et ensuite l'inserer dans une cellule.
Merci a tous
Bonsoir, Si c'est pour une recherche Dichotomique ou autre d'ailleurs cela pourrait ressembler à ceci: '------------- Sub ChercheClient() Dim DerLi&, i&, Libre&, Mot$ Mot = InputBox("Client à chercher :") If Mot = "" Then Exit Sub DerLi = Cells(Rows.Count, "A").End(xlUp).Row For i = DerLi To 3 Step -1 If Application.CountIf _ (Range("A" & i & ":X" & i), "*" & Mot & "*") = 0 Then Range("A" & i).EntireRow.Hidden = True End If Next i If Cells(Rows.Count, "A").End(xlUp).Row = 1 Then Cells.EntireRow.Hidden = False MsgBox "'" & Mot & "' n'a pas été trouvé !" End If End Sub '---------------- Salutations JJ
"MsNewsMicrosoft.com" a écrit dans le message de news:
Bonjour a tous, Comment faire une recherche dichotomique sous excel. Je voudrai pouvoir en tapant quelques lettres afficher la liste des clients
enregistrés et ensuite l'inserer dans une cellule. Merci a tous
Jacky
et pour mettre le tout sur une autre feuille(publié sur ce forum)
Sub ChercheEtAutreFeuille() Dim DerLi&, i&, Libre&, Mot$ Dim Source As Worksheet, Cible As Worksheet
Mot = InputBox("Client à chercher :") If Mot = "" Then Exit Sub Set Source = ActiveSheet Sheets.Add Set Cible = ActiveSheet nom = "Resultat sur " & Mot If Len(nom) > 31 Then nom = "Resultat sur " & Left(Mot, 18) End If 'MsgBox Len(nom) & nom ActiveSheet.Name = nom 'MsgBox ActiveSheet.Name Cible.Range("A1:X1").Value = Source.Range("A1:X1").Value DerLi = Source.Cells(Rows.Count, "A").End(xlUp).Row For i = DerLi To 3 Step -1 If Application.CountIf(Source.Range("A" & i & ":X" & i), "*" & Mot & "*") > 0 Then Libre = Cible.Cells(Rows.Count, "A").End(xlUp).Row + 1 Cible.Range("A" & Libre & ":X" & Libre).Value = Source.Range("A" & i & ":X" & i).Value x = x + 1 End If Next i [a1] = "Resultat pour '" & Mot & "' =" & x If Cible.Cells(Rows.Count, "A").End(xlUp).Row = 1 Then Application.DisplayAlerts = False Cible.Delete Application.DisplayAlerts = True MsgBox "'" & Mot & "' n'a pas été trouvé !" End If End Sub
"Jacky" a écrit dans le message de news:
Bonsoir, Si c'est pour une recherche Dichotomique ou autre d'ailleurs cela pourrait ressembler à ceci: '------------- Sub ChercheClient() Dim DerLi&, i&, Libre&, Mot$ Mot = InputBox("Client à chercher :") If Mot = "" Then Exit Sub DerLi = Cells(Rows.Count, "A").End(xlUp).Row For i = DerLi To 3 Step -1 If Application.CountIf _ (Range("A" & i & ":X" & i), "*" & Mot & "*") = 0 Then Range("A" & i).EntireRow.Hidden = True End If Next i If Cells(Rows.Count, "A").End(xlUp).Row = 1 Then Cells.EntireRow.Hidden = False MsgBox "'" & Mot & "' n'a pas été trouvé !" End If End Sub '---------------- Salutations JJ
"MsNewsMicrosoft.com" a écrit dans le message de news:
Bonjour a tous, Comment faire une recherche dichotomique sous excel. Je voudrai pouvoir en tapant quelques lettres afficher la liste des clients
enregistrés et ensuite l'inserer dans une cellule. Merci a tous
et pour mettre le tout sur une autre feuille(publié sur ce forum)
Sub ChercheEtAutreFeuille()
Dim DerLi&, i&, Libre&, Mot$
Dim Source As Worksheet, Cible As Worksheet
Mot = InputBox("Client à chercher :")
If Mot = "" Then Exit Sub
Set Source = ActiveSheet
Sheets.Add
Set Cible = ActiveSheet
nom = "Resultat sur " & Mot
If Len(nom) > 31 Then
nom = "Resultat sur " & Left(Mot, 18)
End If
'MsgBox Len(nom) & nom
ActiveSheet.Name = nom
'MsgBox ActiveSheet.Name
Cible.Range("A1:X1").Value = Source.Range("A1:X1").Value
DerLi = Source.Cells(Rows.Count, "A").End(xlUp).Row
For i = DerLi To 3 Step -1
If Application.CountIf(Source.Range("A" & i & ":X" & i), "*" & Mot &
"*") > 0 Then
Libre = Cible.Cells(Rows.Count, "A").End(xlUp).Row + 1
Cible.Range("A" & Libre & ":X" & Libre).Value = Source.Range("A" & i &
":X" & i).Value
x = x + 1
End If
Next i
[a1] = "Resultat pour '" & Mot & "' =" & x
If Cible.Cells(Rows.Count, "A").End(xlUp).Row = 1 Then
Application.DisplayAlerts = False
Cible.Delete
Application.DisplayAlerts = True
MsgBox "'" & Mot & "' n'a pas été trouvé !"
End If
End Sub
"Jacky" <Jackyenlevez.jaeg@wanadoo.fr> a écrit dans le message de
news:OKHPaEwTEHA.3844@TK2MSFTNGP11.phx.gbl...
Bonsoir,
Si c'est pour une recherche Dichotomique ou autre d'ailleurs cela pourrait
ressembler à ceci:
'-------------
Sub ChercheClient()
Dim DerLi&, i&, Libre&, Mot$
Mot = InputBox("Client à chercher :")
If Mot = "" Then Exit Sub
DerLi = Cells(Rows.Count, "A").End(xlUp).Row
For i = DerLi To 3 Step -1
If Application.CountIf _
(Range("A" & i & ":X" & i), "*" & Mot & "*") = 0 Then
Range("A" & i).EntireRow.Hidden = True
End If
Next i
If Cells(Rows.Count, "A").End(xlUp).Row = 1 Then
Cells.EntireRow.Hidden = False
MsgBox "'" & Mot & "' n'a pas été trouvé !"
End If
End Sub
'----------------
Salutations
JJ
"MsNewsMicrosoft.com" <jeanmarcfaucon@voila.fr> a écrit dans le message de
news:eiHeptvTEHA.332@TK2MSFTNGP11.phx.gbl...
Bonjour a tous,
Comment faire une recherche dichotomique sous excel.
Je voudrai pouvoir en tapant quelques lettres afficher la liste des
clients
enregistrés et ensuite l'inserer dans une cellule.
Merci a tous
et pour mettre le tout sur une autre feuille(publié sur ce forum)
Sub ChercheEtAutreFeuille() Dim DerLi&, i&, Libre&, Mot$ Dim Source As Worksheet, Cible As Worksheet
Mot = InputBox("Client à chercher :") If Mot = "" Then Exit Sub Set Source = ActiveSheet Sheets.Add Set Cible = ActiveSheet nom = "Resultat sur " & Mot If Len(nom) > 31 Then nom = "Resultat sur " & Left(Mot, 18) End If 'MsgBox Len(nom) & nom ActiveSheet.Name = nom 'MsgBox ActiveSheet.Name Cible.Range("A1:X1").Value = Source.Range("A1:X1").Value DerLi = Source.Cells(Rows.Count, "A").End(xlUp).Row For i = DerLi To 3 Step -1 If Application.CountIf(Source.Range("A" & i & ":X" & i), "*" & Mot & "*") > 0 Then Libre = Cible.Cells(Rows.Count, "A").End(xlUp).Row + 1 Cible.Range("A" & Libre & ":X" & Libre).Value = Source.Range("A" & i & ":X" & i).Value x = x + 1 End If Next i [a1] = "Resultat pour '" & Mot & "' =" & x If Cible.Cells(Rows.Count, "A").End(xlUp).Row = 1 Then Application.DisplayAlerts = False Cible.Delete Application.DisplayAlerts = True MsgBox "'" & Mot & "' n'a pas été trouvé !" End If End Sub
"Jacky" a écrit dans le message de news:
Bonsoir, Si c'est pour une recherche Dichotomique ou autre d'ailleurs cela pourrait ressembler à ceci: '------------- Sub ChercheClient() Dim DerLi&, i&, Libre&, Mot$ Mot = InputBox("Client à chercher :") If Mot = "" Then Exit Sub DerLi = Cells(Rows.Count, "A").End(xlUp).Row For i = DerLi To 3 Step -1 If Application.CountIf _ (Range("A" & i & ":X" & i), "*" & Mot & "*") = 0 Then Range("A" & i).EntireRow.Hidden = True End If Next i If Cells(Rows.Count, "A").End(xlUp).Row = 1 Then Cells.EntireRow.Hidden = False MsgBox "'" & Mot & "' n'a pas été trouvé !" End If End Sub '---------------- Salutations JJ
"MsNewsMicrosoft.com" a écrit dans le message de news:
Bonjour a tous, Comment faire une recherche dichotomique sous excel. Je voudrai pouvoir en tapant quelques lettres afficher la liste des clients
enregistrés et ensuite l'inserer dans une cellule. Merci a tous