Sub MAJ()
Dim ncol%, d As Object, tablo, i&, x$, s, j%, y$, z$, n&, resu(), lig&
ncol = 8 'nombre de colonnes des résultats
Set d = CreateObject("Scripting.Dictionary")
d.CompareMode = vbTextCompare 'la casse est ignoré
'---feuille Methodes---
tablo = Sheets("Methodes").[A2].CurrentRegion.Resize(, 4) 'matrice, plus rapide
For i = 2 To UBound(tablo)
x = tablo(i, 1)
s = Split(tablo(i, 3), ";")
For j = 0 To UBound(s)
y = Trim(s(j))
If y <> "" Then
z = x & y
If Not d.exists(z) Then
n = n + 1
d(z) = n 'mémorise la ligne
ReDim Preserve resu(1 To ncol, 1 To n)
resu(1, n) = x 'Numéro
resu(4, n) = y 'Intervenant
y = LCase(tablo(i, 4))
resu(IIf(y = "air", 5, IIf(y = "sol", 7, 6)), n) = y 'Méthode
End If
End If
Next j, i
'---feuille Actes---
tablo = Sheets("Actes").[A2].CurrentRegion.Resize(, 5) 'matrice, plus rapide
For i = 2 To UBound(tablo)
x = tablo(i, 1)
s = Split(tablo(i, 3), ";")
For j = 0 To UBound(s)
y = Trim(s(j))
If y <> "" Then
z = x & y
If Not d.exists(z) Then
n = n + 1
d(z) = n 'mémorise la ligne
ReDim Preserve resu(1 To ncol, 1 To n)
resu(1, n) = x 'Numéro
resu(4, n) = y 'Intervenant
End If
resu(8, d(z)) = tablo(i, 5) 'UO
End If
Next j, i
'---feuilles Bons---
d.RemoveAll 'RAZ
tablo = Sheets("Bons").[A2].CurrentRegion.Resize(, 3) 'matrice, plus rapide
For i = 2 To UBound(tablo)
x = tablo(i, 1)
If Not d.exists(x) Then d(x) = i 'mémorise la ligne
Next i
For i = 1 To n
x = resu(1, i)
If d.exists(x) Then
lig = d(x)
If IsDate(tablo(lig, 2)) Then resu(2, i) = CDate(tablo(lig, 2)) Else resu(2, i) = tablo(lig, 2)
resu(3, i) = tablo(lig, 3)
End If
Next i
'---transposition---
If n Then
ReDim tablo(1 To n, 1 To ncol)
For i = 1 To n
For j = 1 To ncol
tablo(i, j) = resu(j, i)
Next j, i
End If
'---restitution---
With Sheets("Reporting")
If .FilterMode Then .ShowAllData 'si la feuille est filtrée
With .[A4]
If n Then
.Resize(n, ncol) = tablo
.Resize(n, ncol).Borders.Weight = xlThin 'bordures
End If
.Offset(n).Resize(Rows.Count - n - .Row + 1, ncol).Delete xlUp 'RAZ en dessous
End With
With .UsedRange: End With 'actualise la barre de défilement verticale
End With
End Sub