Sub Mois_suivant()
Dim tablo, col As Variant, d As Object, i&, x$
tablo = [Tableau6].ListObject.Range 'matrice, plus rapide, sur le tableau structuré de la 2ème feuille
With [Tableau3] 'tableau structuré de la 1ère feuille
col = Application.Match(tablo(1, 2), .Rows(0), 0)
If IsError(col) Then MsgBox "Créez la colonne '" & tablo(1, 2) & "' !", 48: Exit Sub
If Application.CountA(.Columns(col)) Then If MsgBox("La colonne '" & tablo(1, 2) & "' a déjà été remplie faut-il continuer ?", vbYesNo) = vbNo Then Exit Sub
'---liste des comptes à copier ou créer---
Set d = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(tablo)
x = CStr(tablo(i, 1))
If x <> "" Then d(x) = tablo(i, 2) 'mémorise la valeur
Next i
'---modification du tableau---
tablo = .Formula 'matrice, plus rapide
For i = 1 To UBound(tablo)
x = CStr(tablo(i, 1))
If d.exists(x) Then
tablo(i, col) = d(x)
d.Remove x 'supprime l'item dans la liste
Else
tablo(i, col) = ""
End If
Next i
'---restiturion---
.Formula = tablo 'matrice, plus rapide
If d.Count = 0 Then Exit Sub
'---création des nouveaux comptes---
With .Rows(.Rows.Count + 1).Resize(d.Count)
.ClearContents
.Columns(1) = Application.Transpose(d.keys) 'limité à 65536 lignes
.Columns(col) = Application.Transpose(d.items)
End With
End With
End Sub