Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
VBA Macro extremely slow: 15 min runtime

This is my code, it takes some values from a file, looks them up in another file and pastes a value in the row where it fins those values. My file tg has 126 lines and 135 columns. My file gar_nv has 2553 lines and 67 columns. My variable nbrLines is equal to 2553. It takes 15 min to finish running. I'm wondering which part is making it so slow ? Or is it because of how big my sheets are. Thanks

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
about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda