Voici une évolution
Option Explicit
Sub importer()
Dim NomFichier As Variant, wkb As Workbook, wks As Worksheet, ligne%, colonne%, param As Worksheet
Dim celR As Range, celC As Range, i%, j%, nbR%, nbC%, deltaC%, deltaR%
Set param = Sheets("paramètres")
nbC = param.Cells(2, Columns.Count).End(xlToLeft).Column
nbR = param.Cells(4, Columns.Count).End(xlToLeft).Column
With ActiveSheet
.UsedRange.ClearContents
ligne = 1
NomFichier = Application.GetOpenFilename("Classeurs Excel(*.xlsx),*.xlsx)")
If NomFichier = False Then Exit Sub
Workbooks.Open Filename:=NomFichier
NomFichier = Dir(NomFichier)
Set wkb = Workbooks(NomFichier)
For i = 2 To nbC
.Cells(ligne, i + 1) = IIf(param.Cells(1, i) = "", "", param.Cells(1, i) & " ")
.Cells(ligne, i + 1) = .Cells(ligne, i + 1) & param.Cells(2, i)
Next
ligne = ligne + 1
For Each wks In wkb.Sheets
For j = 2 To nbR
.Cells(ligne, 1) = wks.Name
.Cells(ligne, 2) = IIf(param.Cells(3, j) = "", "", param.Cells(3, j) & " ")
.Cells(ligne, 2) = .Cells(ligne, 2) & .Cells(ligne, 2) & param.Cells(4, j)
For i = 2 To nbC
deltaC = 0
If param.Cells(1, i).Value <> "" Then
Set celC = wks.UsedRange.Find(what:=param.Cells(1, i).Value)
If Not celC Is Nothing Then deltaC = celC.Column - wks.UsedRange.Column
End If
Set celC = wks.UsedRange.Offset(0, deltaC).Find(what:=param.Cells(2, i).Value)
deltaR = 0
If param.Cells(3, j).Value <> "" Then
Set celR = wks.UsedRange.Find(what:=param.Cells(3, j).Value)
If Not celR Is Nothing Then deltaR = celR.Column - wks.UsedRange.Row
End If
Set celR = wks.UsedRange.Offset(deltaR, 0).Find(what:=param.Cells(4, j).Value)
If Not celR Is Nothing And Not celC Is Nothing Then
.Cells(ligne, i + 1).Value = wks.Cells(celR.Row, celC.Column).Value
End If
Next
ligne = ligne + 1
Next
Next
Workbooks(NomFichier).Close
End With
End Sub
Pour une fois, le fait d'avoir des cellules groupées (qu'il faut généralement bannir) ne me gêne pas ! car dans la recherche, ce qui est important c'est le fait de trouver sa position la plus haute et la plus à gauche ce qui est inhérent aux cellules fusionnées.
Par contre, dans l'onglet paramètres, ne pas les fusionner ! il faut rappeler la valeur de cet en-tête.
J'ai fait de même pour les lignes ... au cas où.