MACRO EXCEL
Résolu
masawi86
Messages postés
24
Date d'inscription
Statut
Membre
Dernière intervention
-
Decapsuleur Messages postés 40 Date d'inscription Statut Membre Dernière intervention -
Decapsuleur Messages postés 40 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'ai ce code :
Sub recherche_multiple()
Dim TBadress() As Variant
Dim Cherche, Ix As Long, PrRow
Dim Valeur_cherchee, texte_a_afficher As String
Valeur_cherchee = InputBox("Indiquez ici le texte que vous cherchez", "Texte recherché")
Set Cherche = Cells.Find(Valeur_cherchee)
If Not Cherche Is Nothing Then
PrRow = Cherche.Row
Do
ReDim Preserve TBadress(Ix)
TBadress(Ix) = Cherche.Row
Set Cherche = Cells.FindNext(Cherche)
Ix = Ix + 1
Loop While Not Cherche Is Nothing And Cherche.Row <> PrRow
End If
For Ix = 0 To UBound(TBadress)
texte_a_afficher = texte_a_afficher & vbCrLf & " Ligne : " & TBadress(Ix) & " " & Valeur_cherchee
Next
MsgBox texte_a_afficher
End Sub
ce code fé une recherche multiple j'ai donné le nom et affiche les lignes ou se trouve ces lignes exemple : j'ai donnée SAP retourne L2 sap
L5 sap
mais moi je cherche ou place de donnée SAP o unix et lui retourné
lui donnée sons demandé ou début
exemple: L1 SAP
L2 UNIX
L3 ORACLE
L5 SAP
.
.
.
ET MERCI
j'ai ce code :
Sub recherche_multiple()
Dim TBadress() As Variant
Dim Cherche, Ix As Long, PrRow
Dim Valeur_cherchee, texte_a_afficher As String
Valeur_cherchee = InputBox("Indiquez ici le texte que vous cherchez", "Texte recherché")
Set Cherche = Cells.Find(Valeur_cherchee)
If Not Cherche Is Nothing Then
PrRow = Cherche.Row
Do
ReDim Preserve TBadress(Ix)
TBadress(Ix) = Cherche.Row
Set Cherche = Cells.FindNext(Cherche)
Ix = Ix + 1
Loop While Not Cherche Is Nothing And Cherche.Row <> PrRow
End If
For Ix = 0 To UBound(TBadress)
texte_a_afficher = texte_a_afficher & vbCrLf & " Ligne : " & TBadress(Ix) & " " & Valeur_cherchee
Next
MsgBox texte_a_afficher
End Sub
ce code fé une recherche multiple j'ai donné le nom et affiche les lignes ou se trouve ces lignes exemple : j'ai donnée SAP retourne L2 sap
L5 sap
mais moi je cherche ou place de donnée SAP o unix et lui retourné
lui donnée sons demandé ou début
exemple: L1 SAP
L2 UNIX
L3 ORACLE
L5 SAP
.
.
.
ET MERCI
A voir également:
- MACRO EXCEL
- Telecharger macro convertir chiffre en lettre excel - Télécharger - Tableur
- Liste déroulante excel - Guide
- Word et excel gratuit - Guide
- Déplacer colonne excel - Guide
- Si ou excel - Guide
2 réponses
Bonjour,
Je n'ai pas tout compris : mais moi je cherche ou place de donnée SAP o unix et lui retourné
lui donnée sons demandé ou début
Et franchement, je ne dois pas être le seul...
Je n'ai pas tout compris : mais moi je cherche ou place de donnée SAP o unix et lui retourné
lui donnée sons demandé ou début
Et franchement, je ne dois pas être le seul...
Alors ceci te conviendrait il peut être?
Sub recherche_vraiment_tres_tres_multiple() Dim valeurs, TBadress(), val As Variant Dim i, derlig, Ix As Integer Dim cherche As Range valeurs = Array("sap", "unix", "oracle") 'ajouter les valeurs que vous souhaitez chercher avec des virgules... derlig = Range("A65536").End(xlUp).Row ' à adapter également For i = 1 To derlig With ActiveSheet.Rows(i) For Each val In valeurs Set cherche = .Cells.Find(val) If Not cherche Is Nothing Then ReDim Preserve TBadress(Ix) TBadress(Ix) = "Ligne " & cherche.Row & " " & val Ix = Ix + 1 End If Next End With Next i For Ix = 0 To UBound(TBadress) texte_a_afficher = texte_a_afficher & vbCrLf & TBadress(Ix) Next MsgBox texte_a_afficher End Sub
j'ai besoin d'une macro vba qui lire les lignes de la feuille excel et affiche dans un MsgBox .
si il y a dans la linge un texte crier a la forme de"Xnn"( c a d [A-Z][0-9][0-9]) retourner erreur SAP
si il y a dans la linge "ORA-" retourner erreur ORACLE
quand dans la ligne ne trouver ni "ORA-" ni le texte de la forme "Xnn" retourner erreur inconnu
et merci
svp aide moi
si il y a dans la linge un texte crier a la forme de"Xnn"( c a d [A-Z][0-9][0-9]) retourner erreur SAP
si il y a dans la linge "ORA-" retourner erreur ORACLE
quand dans la ligne ne trouver ni "ORA-" ni le texte de la forme "Xnn" retourner erreur inconnu
et merci
svp aide moi
slt
j'ai ce programme mais quand j'ai exécuté il donne" erreur d'exécution
l'indice n'appartient pas a la sélection "
Sub recherche()
Dim valeurs, TBadress(), val As Variant
Dim i, derlig, Ix As Integer
Dim cherche As Range
valeurs = Array("[a-z]##")
derlig = Range("A65536").End(xlUp).Row
For i = 1 To derlig
With ActiveSheet.Rows(i)
For Each val In valeurs
Set cherche = .Cells.Find(val)
If Not cherche Is Nothing Then
ReDim Preserve TBadress(Ix)
TBadress(Ix) = "Ligne " & cherche.Row & " " & val
Ix = Ix + 1
End If
Next
End With
Next i
For Ix = 0 To UBound(TBadress)
texte_a_afficher = texte_a_afficher & vbCrLf & TBadress(Ix)
Next
MsgBox texte_a_afficher
End Sub
svp personne m'aide
j'ai ce programme mais quand j'ai exécuté il donne" erreur d'exécution
l'indice n'appartient pas a la sélection "
Sub recherche()
Dim valeurs, TBadress(), val As Variant
Dim i, derlig, Ix As Integer
Dim cherche As Range
valeurs = Array("[a-z]##")
derlig = Range("A65536").End(xlUp).Row
For i = 1 To derlig
With ActiveSheet.Rows(i)
For Each val In valeurs
Set cherche = .Cells.Find(val)
If Not cherche Is Nothing Then
ReDim Preserve TBadress(Ix)
TBadress(Ix) = "Ligne " & cherche.Row & " " & val
Ix = Ix + 1
End If
Next
End With
Next i
For Ix = 0 To UBound(TBadress)
texte_a_afficher = texte_a_afficher & vbCrLf & TBadress(Ix)
Next
MsgBox texte_a_afficher
End Sub
svp personne m'aide
lui donnée sons demandé ou début
Mais : mais moi je cherche ou place de donnée SAP o unix et lui retourné J'ai beau essayé, je ne comprends pas!!
Dis nous simplement ce que tu veux...
Sub recherche_multiple()
Dim TBadress() As Variant
Dim Cherche, Ix As Long, PrRow
Dim Valeur_cherchee, texte_a_afficher As String
*****Set Cherche = Cells.Find(SAP) *************
******Set Cherche = Cells.Find(UNIX) **********
If Not Cherche Is Nothing Then
PrRow = Cherche.Row
Do
Si oui :
Combien de mots au maximum?
6 MOTS