bonjour à tous !
voici un code que j'utilisé dans un fichier avec seulement 2 onglets. du coup je n'avais aucun souci pour la recherche, toutefois j'ai désormais besoin de 6 onglets ou feuilles, du coup lorsque le code s'éxecute il fait la recherche dans TOUS les onglets, or j'aimerais si cela est faisable limité la recherche à seulment l'onglet nommé BDD donc le deuxieme.
est ce possible ? si oui comment et ou modifie t'on le code ?
un grand merci à ceux qui pourront me répondre et m'expliquer car là je ne vois ou se trouve l'endroit ou il fait sa recherche.
voici un code que j'utilisé dans un fichier avec seulement 2 onglets. du coup je n'avais aucun souci pour la recherche, toutefois j'ai désormais besoin de 6 onglets ou feuilles, du coup lorsque le code s'éxecute il fait la recherche dans TOUS les onglets, or j'aimerais si cela est faisable limité la recherche à seulment l'onglet nommé BDD donc le deuxieme.
est ce possible ? si oui comment et ou modifie t'on le code ?
Code:
Sub recherche(mot)
Sheets("page d'ouverture").Range("A9:IV65536").Clear
ligne = 9
For Each ws In Sheets
If ws.Name <> "page d'ouverture" Then
With ws.Cells
Set c = .Find(mot, LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
firstAddress = c.Address
Do
ws.Rows(c.Row).Copy Destination:=Sheets("page d'ouverture").Cells(ligne, 1)
ligne = ligne + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
trouve = True
End If
End With
End If
Next ws
x = Sheets("page d'ouverture").Range("B65536").End(xlUp).Row
If x > 14 Then
For n = x To 15 Step -1
For m = 1 To 7
xx = xx & Sheets("page d'ouverture").Cells(n, m)
yy = yy & Sheets("page d'ouverture").Cells(n - 1, m)
Next m
If yy = xx Then Sheets("page d'ouverture").Rows(n).Delete
xx = ""
yy = ""
Next n
End If
If Not trouve Then MsgBox ("Le mot " & mot & " n'a pas été trouvé dans ce fichier")
End Sub
un grand merci à ceux qui pourront me répondre et m'expliquer car là je ne vois ou se trouve l'endroit ou il fait sa recherche.