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

119
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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