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

121
Vistas
VBA Fastest way to filter for 2 specific conditions

I have a sheet called gar_nv of 2553 rows and 135 named columns. My code looks for a row containing 2 values: produit and acte, and pastes the variable Remb in the appropriate "Col" column. I'm wondering if there's a faster way to do this ?

For Line = 1 To gar_nv.Cells(Rows.Count, 1).End(xlUp).Row
                'produit, acte, Col and Remb are variables defind above
     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
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You could write the ranges to variant arrays, as iterating through those would be much faster, e.g.

Dim GCGAR6, GCBARB
GCGAR6 = Range("GCGAR6").Value2
GCBARB = Range("GCBARB").Value2
.....
For Line = 1 To gar_nv.Cells(Rows.Count, 1).End(xlUp).Row
                'produit, acte, Col and Remb are variables defind above
    If InStr(1, GCGAR6(Line, 1), produit) Then
        If InStr(1, GCBARB(Line, 1), acte) Then
              gar_nv.Cells(Line,Col).Value2 = Remb    
        End If
    End If
Next Line
about 4 years ago · Santiago Trujillo Denunciar
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