Este es mi código, toma algunos valores de un archivo, los busca en otro archivo y pega un valor en la fila donde encuentra esos valores. Mi archivo tg tiene 126 líneas y 135 columnas. Mi archivo gar_nv tiene 2553 líneas y 67 columnas. Mi variable nbrLines es igual a 2553. Tarda 15 minutos en terminar de ejecutarse. Me pregunto qué parte lo está haciendo tan lento. ¿O es por lo grandes que son mis sábanas? Gracias
Sub Remb() Call Workbook_open Dim acte, acte_next, Remb, Col, Col_next, produit As Variant Dim colonne, ligne, Line, r, c As Long With tg For colonne = col_dep To .UsedRange.Columns.Count For ligne = ligne_dep To nbrLines acte = tg.Range(ColName(colonne) & ligne) r = ligne c = Columns(ColName(colonne)).Column MsgBox (acte) If Not IsEmpty(acte) Then Remb = .Cells(r, c).Offset(0, -1).Value Col = .Cells(r, c).Offset(0, 1).Value produit = .Cells(6, c).Value acte_next = .Cells(r, c).Offset(1, 0).Value Col_next = .Cells(r, c).Offset(1, 1).Value For Line = 1 To gar_nv.Cells(Rows.Count, 1).End(xlUp).Row If gar_nv.Range("GCGAR6").Rows(Line).Value Like produit Then If gar_nv.Range("GCBARB").Rows(Line).Value Like acte Then gar_nv.Range(Col).Rows(Line).Value = Remb End If End If Next Line End If Next ligne Next colonne End With End Sub