Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

139
Vistas
Faster way to loop through large transaction lists

Objective: I am building the a macro below with the intention comparing what has changed in a transaction list (TL) as it grows with ongoing posting of new transactions. I want to know exactly what has changed between the new TL and the old TL, so that Old TL + Changes = New TL...

How I did it so far: The method is to flag transactions in 2 separate sheets (old TL, new TL) with same columns layout filled with transactions as follows:

  • Exact match (exact same string of concatenated row in both sheets)
  • Partial match (not exact same string, but same document number in both sheets)
  • No match (no exact string, no exact doc number in other sheet)

Challenge: My code runs but with 50,000 records between the sheets it takes about 15 minutes

Question: Does anyone have a suggestion how I could make the code below run faster (extract) - where all variables are ranges except nrws and cls which is are doubles.

    For l = 2 To nrws
        Set nkey = nTL.Cells(l, cls + 1)
        Set ndoc = nTL.Cells(l, 5)
        nTL.Cells(l, cls + 2) = Application.WorksheetFunction.CountIf(nkeyList, nkey)
        nTL.Cells(l, cls + 3) = Application.WorksheetFunction.CountIf(okeyList, nkey)
        nTL.Cells(l, cls + 4) = Application.WorksheetFunction.CountIf(ndocList, ndoc)
        nTL.Cells(l, cls + 5) = Application.WorksheetFunction.CountIf(odocList, ndoc)
        If nTL.Cells(l, cls + 3) = 0 Then
            If nTL.Cells(l, cls + 5) = 0 Then
                nTL.Cells(l, cls + 6) = "No Match"
            Else: nTL.Cells(l, cls + 6) = "Partial Match"
            End If
        ElseIf nTL.Cells(l, cls + 2) = nTL.Cells(l, cls + 3) And nTL.Cells(l, cls + 4) = nTL.Cells(l, cls + 5) Then
            nTL.Cells(l, cls + 6) = "Exact Match"
        ElseIf nTL.Cells(l, cls + 2) = nTL.Cells(l, cls + 3) Then
            nTL.Cells(l, cls + 6) = "Partial Match"
        Else
            nTL.Cells(l, cls + 6) = "Check"
        End If
    Next l

Thanks in advance - Let me know if I omitted something.

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda