Bonsoir à tous,
J'ai fait le test, effectivement si le tableau à retranscrire comporte plus de 65000 lignes, ça bug .....
Je ne maitrise pas suffisamment pour t'aider d'avantage, je pense qu'il va falloir filtrer avant puis retranscrire les données ensuite.....comme le suggérait Dan depuis le début...
Après recherche, la limite pour Application.transpose est atteinte......, il va falloir procéder autrement.......
Sub Bouton1_Cliquer()
Dim tb, Newtb(), i&, k&, crit
crit = Sheets("Regroupement").Range("R1").CurrentRegion
With Sheets("DSN")
tb = .Range("A1").CurrentRegion
k = 0
ReDim Newtb(0 To UBound(tb, 1), 1 To 3)
For i = 1 To UBound(tb, 1)
For j = 2 To UBound(crit, 1)
If tb(i, 1) Like "*" & crit(j, 1) & "*" Then
Newtb(k, 1) = tb(i, 1)
Newtb(k, 2) = Left(tb(i, 1), 14)
Newtb(k, 3) = Mid(tb(i, 1), 16, 99)
k = k + 1
End If
Next j
Next i
End With
If k > 0 Then
With Sheets("Base")
On Error Resume Next
.Cells.Borders.LineStyle = xlLineStyleNone
.Range("A1").CurrentRegion.Offset(1, 0).ClearContents
.Range("A2").Resize(k, 3).Value = Newtb
.Range("D2").FormulaR1C1 = "=IF(RC[-2]=""S21.G00.30.001"",RC[-1],R[-1]C)"
.Range("D2:D" & .Range("A" & Rows.Count).End(xlUp).Row).FillDown
.Range("A1").CurrentRegion.Borders.Weight = xlThin
.Activate
End With
End If
Erase tb: Erase Newtb: crit = ""
End Sub
https://forum.excel-pratique.com/excel/limitation-application-transpose-124094
Testé avec 239 000 lignes en DSN : résultat==> 89 992 en BASE ..
Cordialement,