Sub Cherche()
On Error GoTo Fin
Dim IndexArt%, IndexW%, Article$, Sh As Worksheet
Sheets("RESULT").Range("B4:Z5").ClearContents
' Renseignement article
IndexArt = Application.Match(Sheets("GLOBAL").[Article], Sheets("GLOBAL").Range("A:A"), 0)
Sheets("RESULT").[Ref] = Sheets("GLOBAL").Cells(IndexArt, "A")
Sheets("RESULT").[Description] = Sheets("GLOBAL").Cells(IndexArt, "B")
Sheets("RESULT").[CodeArt] = Sheets("GLOBAL").Cells(IndexArt, "C")
Sheets("RESULT").[PxGlob] = Sheets("GLOBAL").Cells(IndexArt, "D")
' Recherche clients
Article = Sheets("RESULT").[Article]
IndexW = 2
' Pour toutes les feuilles
For Each Sh In ThisWorkbook.Worksheets
If Sh.Name <> "GLOBAL" And Sh.Name <> "RESULT" Then ' Exclusion des feuilles non client
With Sheets(Sh.Name)
If Not IsError(Application.Match(Article, .Range("A:A"), 0)) Then
' Si l'article existe
IndexArt = Application.Match(Article, .Range("A:A"), 0)
Sheets("RESULT").Cells(4, IndexW) = .Range("A1")
Sheets("RESULT").Cells(5, IndexW) = .Cells(IndexArt, "D")
IndexW = IndexW + 1
Else
' Si l'article n'existe pas
Sheets("RESULT").Cells(4, IndexW) = .Range("A1")
Sheets("RESULT").Cells(5, IndexW) = "X" ' mettre X par defaut.
IndexW = IndexW + 1
End If
End With
End If
Next Sh
Fin:
End Sub