Salut
Oula, tu as changé la donne
Si je comprend bien tu as 3 cas 1 et 1; 2 et 2; 2 et 1
On peut simplifier ca en 1 et 1; 2 et (1 ou 2)
Donc j'en déduis une seul boucle, a modifier dans le code
cette boucle remplace tes 3 boucles et fais je pense exactement la même chose, tu viens donc de diviser par 3 le temps d'exécution de ta macro ;)Code:
1
2
3
4
5
6
7
8
9
10 With TheSheet For Each TheColCell In .Range("H1", .Cells(1, Columns.Count).End(xlToLeft)) If (TheColCell = "1") Or (TheColCell = "2") Then For Each TheCell In .Range("A2", .Cells(Rows.Count, "A").End(xlUp)) If (TheCell = "1") Or (TheColCEll = "2" And TheCell = "2") Then FichierDestin.Sheets(TheSheet.Name).Cells(TheCell.Row, TheColCell.Column) = .Cells(TheCell.Row, TheColCell.Column) End If Next End If Next
A++
Qwaz