Option Explicit
Private Sub CommandButton1_Click()
Dim Chemin As String, NomFichier As String, Critere As String
Dim Fs As FileSearch
Dim FichierLu As Variant
Dim WBCible As Workbook
Dim CellCible As Range
Chemin = ThisWorkbook.Path
NomFichier = ActiveWorkbook.Name
Critere = 'OUI'
Set Fs = Application.FileSearch
With Fs
.NewSearch
.LookIn = Chemin
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
.Filename = '*' & Critere & '*.xls'
If .Execute > 0 Then
MsgBox 'Ce dossier contient ' & .FoundFiles.Count & _
' fichier(s) répondant au critère.'
For Each FichierLu In .FoundFiles
If Not FichierLu = ThisWorkbook.FullName Then
MsgBox 'Scan actuellement ' & FichierLu
Set WBCible = Workbooks.Open(FichierLu)
On Error GoTo ErrorHandlerNoTwoSheets
Set CellCible = WBCible.Worksheets(2).Cells(9, 13)
MsgBox 'Valeur Cellule Cible ' & CellCible
WBCible.Close 0
On Error GoTo 0
End If
Next
End If
End With
Exit Sub
ErrorHandlerNoTwoSheets:
MsgBox 'Le Fichier ' & WBCible.Name & ' ne contient qu'une seule Feuille'
End Sub