Notifications
Clear all

FILTRO AVANÇADO - Ajuda

42 Posts
2 Usuários
0 Reactions
17.4 K Visualizações
(@danyahoo)
Posts: 49
Eminent Member
Topic starter
 

Olá pessoal, venho pedir vossa ajuda novamente!

Tenho uma planilha de banco de dados com o nome MOVCAIXA2 e preciso criar um filtro de pesquisa avançada em outra planilha.

Os filtros que preciso são: Ano Exercício, Nº OP e Transação de Origem.

Neste tópico o assunto é muito semelhante ao meu, porem não consegui aplicar a solução de lá em meu problema. Lá é para apenas 1 filtro, eu preciso de 3.

É possivel usar a mesma lógica da planilha disponibilizada lá para meu propósito?
É possivel, por exemplo, colocar o ano de exercício 2002 e a planilha buscar todos os registros de 2002, ou colocar Nº OP 500 e ele busca todas as OPs 500 de todos os anos, ou ainda Ano 2002, OP 500, Transação de Origem OPB e ele busca exatamente este registro?

Gostaria de aprender como fazer este filtro avançado para mais adiante acrescentar um período de datas, CPF/CNPJ etc.

Obrigado!

 
Postado : 27/03/2012 1:14 pm
(@danyahoo)
Posts: 49
Eminent Member
Topic starter
 

Este é o código determinante para fazer a busca:

    Selection.AutoFilter Field:=5, Criteria1:=CStr("*" + XXXXXXXXX.Value) + "*"

Porem ele somente funciona se a coluna estiver como TEXTO.

Como seria o código para uma coluna com números?

 
Postado : 30/03/2012 11:36 am
(@danyahoo)
Posts: 49
Eminent Member
Topic starter
 

Olá... descobri como colocar número, segue os códigos:

     Selection.AutoFilter Field:=1, Criteria1:=CStr("=" & XXXXXXXXXXX.Text)

ou

     Selection.AutoFilter Field:=0, Criteria1:="=" & XXXXXXXXXX.Text

Ele filtra em cima do dado que buscamos, porem quando apagamos o campo ele não retorna os valores originais.

No código de TEXTO quando apago o campo ele retorna o filtro para o inicial.

O que devo fazer no código de números para que quando apague ele retorne todo o filtro?

 
Postado : 30/03/2012 11:59 am
(@danyahoo)
Posts: 49
Eminent Member
Topic starter
 

To ficando bão na coisa!!!!

If AnoExercicio.Text <> "" Then
    Selection.AutoFilter Field:=1, Criteria1:="=" & AnoExercicio.Text
    Else
    Selection.AutoFilter Field:=1
End If

Com esse código ele retorna ao valor original!!! :mrgreen:

 
Postado : 30/03/2012 12:04 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Dany, parabens pela dedicação que está se empenhando em encontrar a solução e tambem por estar compartilhando.

Como não tenho o seu modelo, não posso ajudar muito, mas pelo que estou vendo, quando eu tiver acesso a ele, não irá mais precisar de ajuda.

[]s

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 30/03/2012 12:08 pm
(@danyahoo)
Posts: 49
Eminent Member
Topic starter
 

Dany, parabens pela dedicação que está se empenhando em encontrar a solução e tambem por estar compartilhando.

Como não tenho o seu modelo, não posso ajudar muito, mas pelo que estou vendo, quando eu tiver acesso a ele, não irá mais precisar de ajuda.

[]s

Será???? hehehe

Já já vão me internar pq estou virando um Excelcólotra....... :D

 
Postado : 30/03/2012 12:12 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Normal Danyaho
Também fiquei viciado ao conhecer o Planilhando...

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 30/03/2012 2:02 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Boa tarde!!

Dany, meus parabéns!!!

Você está mesmo com as turbinas ligadas!! :lol:

Att

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 30/03/2012 2:23 pm
(@danyahoo)
Posts: 49
Eminent Member
Topic starter
 

Olá pessoal!

Necessito novamente de vossa ajuda!

É a mesma planilha, porem ela creceu e ficou mais robusta.

Problema atual: Adequar a planilha para novos critérios, havendo a possibilidade de múltiplos critérios para a pesquisa.

Agora temos 9 critérios:

A2, B2, C2, D2, E2, G2, H2, I2, J2

O código atual engloba apenas os critérios A2, B2, C2, D2 e E2, conforme código abaixo:

Sub NovaVersao()
    Dim LR As Long
    Rows(6).Resize(100).Delete

    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" Then AleVBA = 1
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" Then AleVBA = 2
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" Then AleVBA = 3
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" Then AleVBA = 4
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" Then AleVBA = 5


    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" Then AleVBA = 6
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" Then AleVBA = 7
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" Then AleVBA = 8
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" Then AleVBA = 9
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" Then AleVBA = 10
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" Then AleVBA = 11
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" Then AleVBA = 12
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") = "" Then AleVBA = 13
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") <> "" Then AleVBA = 14
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") <> "" Then AleVBA = 15


    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" Then AleVBA = 16
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" Then AleVBA = 17
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" Then AleVBA = 18
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") = "" Then AleVBA = 19
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") <> "" Then AleVBA = 20
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") <> "" Then AleVBA = 21
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") = "" Then AleVBA = 22
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") <> "" Then AleVBA = 23
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") <> "" Then AleVBA = 24
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") <> "" Then AleVBA = 25
 

    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") = "" Then AleVBA = 26
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") <> "" Then AleVBA = 27
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") <> "" Then AleVBA = 28
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") <> "" Then AleVBA = 29
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") <> "" Then AleVBA = 30
    
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("g2") <> "" Then AleVBA = 31

    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") <> "" Then fjpVBA = 32

    
Select Case AleVBA 

Case 1
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
        .Copy Range("a6")
        .AutoFilter
    End With
  
 
Case 2
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=4, Criteria1:=Range("b2")
        .Copy Range("a6")
        .AutoFilter
    End With


Case 3
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=8, Criteria1:=Range("c2")
        .Copy Range("a6")
        .AutoFilter
    End With
 
Case 4
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=21, Criteria1:=Range("d2")
        .Copy Range("a6")
        .AutoFilter
    End With
   
Case 5
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With
   
 
Case 6
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
        .AutoFilter Field:=4, Criteria1:=Range("b2")
        .Copy Range("a6")
        .AutoFilter
    End With
    

Case 7
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
        .AutoFilter Field:=8, Criteria1:=Range("c2")
        .Copy Range("a6")
        .AutoFilter
    End With

Case 8
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
        .AutoFilter Field:=21, Criteria1:=Range("d2")
        .Copy Range("a6")
        .AutoFilter
    End With
  

Case 9
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
        .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 10
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=4, Criteria1:=Range("b2")
        .AutoFilter Field:=8, Criteria1:=Range("c2")
        .Copy Range("a6")
        .AutoFilter
    End With

Case 11
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=4, Criteria1:=Range("b2")
        .AutoFilter Field:=21, Criteria1:=Range("d2")
        .Copy Range("a6")
        .AutoFilter
    End With

Case 12
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 13
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=8, Criteria1:=Range("c2")
        .AutoFilter Field:=21, Criteria1:=Range("d2")
        .Copy Range("a6")
        .AutoFilter
    End With

Case 14
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 15
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=21, Criteria1:=Range("d2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 16
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=8, Criteria1:=Range("c2")
    .Copy Range("a6")
        .AutoFilter
    End With

Case 17
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=21, Criteria1:=Range("d2")
    .Copy Range("a6")
        .AutoFilter
    End With

Case 18
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 19
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=21, Criteria1:=Range("d2")
    .Copy Range("a6")
        .AutoFilter
    End With

Case 20
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 21
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=21, Criteria1:=Range("d2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 22
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=21, Criteria1:=Range("d2")
    .Copy Range("a6")
        .AutoFilter
    End With

Case 23
    With Sheets("MOVCAIXA").UsedRange
    .AutoFilter Field:=4, Criteria1:=Range("b2")
        .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 24
    With Sheets("MOVCAIXA").UsedRange
    .AutoFilter Field:=4, Criteria1:=Range("b2")
        .AutoFilter Field:=21, Criteria1:=Range("d2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 25
    With Sheets("MOVCAIXA").UsedRange
    .AutoFilter Field:=8, Criteria1:=Range("c2")
        .AutoFilter Field:=21, Criteria1:=Range("d2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 26
    With Sheets("MOVCAIXA").UsedRange
    .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=21, Criteria1:=Range("d2")
    .Copy Range("a6")
        .AutoFilter
    End With

Case 27
    With Sheets("MOVCAIXA").UsedRange
    .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 28
    With Sheets("MOVCAIXA").UsedRange
    .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=21, Criteria1:=Range("d2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 29
    With Sheets("MOVCAIXA").UsedRange
    .AutoFilter Field:=1, Criteria1:=Range("a2")
    .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=21, Criteria1:=Range("d2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 30
    With Sheets("MOVCAIXA").UsedRange
    .AutoFilter Field:=4, Criteria1:=Range("b2")
    .AutoFilter Field:=8, Criteria1:=Range("c2")
    .AutoFilter Field:=21, Criteria1:=Range("d2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

Case 31
    With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=35, Criteria1:=Range("g2")
        .Copy Range("a6")
        .AutoFilter
    End With

Case Else
   With Sheets("MOVCAIXA").UsedRange
        .AutoFilter Field:=1, Criteria1:=Range("a2")
        .AutoFilter Field:=4, Criteria1:=Range("b2")
        .AutoFilter Field:=8, Criteria1:=Range("c2")
        .AutoFilter Field:=21, Criteria1:=Range("d2")
    .AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
        .Copy Range("a6")
        .AutoFilter
    End With

End Select
End Sub

Tentei adequar o código acima para os novos critérios usando a mesma lógica, porem o código ficaria uma aberração ai parei para achar outra solução. Segue abaixo o esboço de como estava ficando o "monstro":
(Deletei boa parte, pois o limite de caracteres permitidos é 60000)

Sub NovaVersao()
    Dim LR As Long
    Rows(6).Resize(100).Delete

    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 1
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 2
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 3
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 4
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 5
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 6
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 7
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 8
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 9
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 10
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 11
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 12
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA =    
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 13
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 14
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA =  
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 15
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") = "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 16
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 17
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 18
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") <> "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 19
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 20
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 21
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") <> "" And Range("b2") = "" And Range("c2") = "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") <> "" Then AleVBA = 

    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") <> "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 22
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") <> "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 23
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") <> "" And Range("H2") = "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") <> "" And Range("I2") = "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") <> "" And Range("J2") = "" Then AleVBA = 
    If Range("a2") = "" And Range("b2") <> "" And Range("c2") <> "" And Range("d2") = "" And Range("e2") = "" And Range("G2") = "" And Range("H2") = "" And Range("I2") = "" And Range("J2") <> "" Then AleVBA = 

Assim tentei adequar o código disponibilizado pelo Reinaldo para o problema atual, inicialmente o código está assim:

Sub FiltroAle()
    Dim lastColum, lastRow As Long
        lastRow = Sheets("MOVCAIXA").Cells(Cells.Rows.Count, "A").End(xlUp).Row
        lastColum = Sheets("MOVCAIXA").Cells(lastRow, Cells.Columns.Count).End(xlToLeft).Address

Sheets("Lancamento").Rows(6).Resize(1000).Delete

If Range("a2").Value <> "" Then
d1 = Range("a2").Value
Else
d1 = "<>""" '">0"
End If

If Range("b2").Value <> "" Then
d2 = Range("b2").Value
Else
d2 = "<>""" '">0"
End If

If Range("c2").Value <> "" Then
d3 = Range("c2").Value
Else
d3 = "<>""" '">0"
End If

If Range("d2").Value <> "" Then
d4 = Range("d2").Value
Else
d4 = "<>""" '">0"
End If

If Range("e2").Value <> "" Then
d5 = ">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
d41 = "<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
Else
d5 = "<>""" '">0"
End If

If Range("g2").Value <> "" Then
d6 = Range("g2").Value
Else
d6 = "<>""" '">0"
End If

If Range("h2").Value <> "" Then
d7 = Range("h2").Value
Else
d7 = "<>""" '">0"
End If

If Range("i2").Value <> "" Then
d8 = Range("i2").Value
Else
d8 = "<>""" '">0"
End If

If Range("j2").Value <> "" Then
d9 = Range("j2").Value
Else
d9 = "<>""" '">0"
End If

With Sheets("MOVCAIXA").Range("A1:" & lastColum) 'UsedRange
        
    .AutoFilter Field:=1, Criteria1:=d1 'Range("a2")
    .AutoFilter Field:=4, Criteria1:=d2 'Range("b2")
    .AutoFilter Field:=8, Criteria1:=d3 'Range("c2")
    .AutoFilter Field:=25, Criteria1:=d4 'Range("d2")
    .AutoFilter Field:=31, Criteria1:=d5 & d41 'Range("e2")
    .AutoFilter Field:=39, Criteria1:=d6 'Range("g2")
    .AutoFilter Field:=10, Criteria1:=d7 'Range("h2")
    .AutoFilter Field:=11, Criteria1:=d8 'Range("i2")
    .AutoFilter Field:=41, Criteria1:=d9 'Range("j2")
    .Copy Range("a6")
    .AutoFilter
    End With
End Sub

Porem ele busca apenas o critério A2, nenhum outro funciona.

Para finalizar, segue o código original postado pelo Reinaldo e uma planilha de modelo anexa:

Sub FiltroAle()
Dim lastColum, lastRow As Long
        lastRow = Sheets("A2002").Cells(Cells.Rows.Count, "A").End(xlUp).Row
        lastColum = Sheets("A2002").Cells(lastRow, Cells.Columns.Count).End(xlToLeft).Address

Sheets("Lancamento").Rows(6).Resize(1000).Delete
    If Range("a2").Value <> "" Then
        d1 = Range("a2").Value
    Else
        d1 = "<>""" '">0"
    End If
    If Range("b2").Value <> "" Then
        d2 = Range("b2").Value
    Else
        d2 = "<>""" '">0"
    End If
    If Range("c2").Value <> "" Then
        d3 = Range("c2").Value
    Else
        d3 = "<>""" '">0"
    End If
    If Range("d2").Value <> "" Then
        d4 = Format(Range("D2"), "m/dd/yyyy")
        d41 = Range("D3")
    Else
        d4 = "<>""" '">0"
    End If

With Sheets("A2002").Range("A1:" & lastColum) 'UsedRange        
    .AutoFilter Field:=1, Criteria1:=d1 'Range("a2")
    .AutoFilter Field:=3, Criteria1:=d2 'Range("b2")
    .AutoFilter Field:=11, Criteria1:=d3 'Range("c2")
    .AutoFilter Field:=24, Criteria1:=d41 & d4 'Range("c2")
    .Copy Range("a6")
    .AutoFilter
    End With
End Sub

Obrigado!

 
Postado : 24/04/2012 8:57 am
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Eu gostaria de fazer alguns testes, utilizando o modelo que informei inicialmente, porem como não conheco a estrutura de sua planilha, gostaria que Vc me informe ou mostre no exemplo a que campo (Field) se refere cd celula de fitro; pois aparentemente alguns campos mudaram de posição.
Exemplo: No codigo vc tem:
.AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
Sendo que: Field:=24 corresponde à coluna "X" (Grupo Despesa) Codigo geral de 1 digito, em e E2 = data inicial (Não sei do que), formatada como geral.
Ou seja, e passada uma data como numero, para um campo geral de 1 digito, com certeza não irá filtrar nada.

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 24/04/2012 11:33 am
(@danyahoo)
Posts: 49
Eminent Member
Topic starter
 

Eu gostaria de fazer alguns testes, utilizando o modelo que informei inicialmente, porem como não conheco a estrutura de sua planilha, gostaria que Vc me informe ou mostre no exemplo a que campo (Field) se refere cd celula de fitro; pois aparentemente alguns campos mudaram de posição.
Exemplo: No codigo vc tem:
.AutoFilter Field:=24, Criteria1:=">=" & Format(Range("e2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat), Operator:=xlAnd, Criteria2:="<=" & Format(Range("f2").Value, Sheets("MOVCAIXA").Range("X2").NumberFormat)
Sendo que: Field:=24 corresponde à coluna "X" (Grupo Despesa) Codigo geral de 1 digito, em e E2 = data inicial (Não sei do que), formatada como geral.
Ou seja, e passada uma data como numero, para um campo geral de 1 digito, com certeza não irá filtrar nada.

Prezado Reinaldo,

Desculpe a falha, durante a evolução da planilha entraram 5 novas colunas, o que deslocou a coluna de referência das datas em 5 celulas, passando a ser Field:=29.

A planilha evoluiu porem quando tentei evoluir os códigos esbarrei no problema dos novos critérios.

 
Postado : 24/04/2012 12:10 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Veja no anexo. Os teste que efetuei, funcionou, teste e se houver diferença retorne com a combinação que não deu

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 24/04/2012 1:27 pm
(@danyahoo)
Posts: 49
Eminent Member
Topic starter
 

Veja no anexo. Os teste que efetuei, funcionou, teste e se houver diferença retorne com a combinação que não deu

Reinaldo, FANTÁSTICO!!!

Vou implementar na base principal e fazer todos os testes possível, a priori está perfeito!

Muito obrigado!

 
Postado : 24/04/2012 1:45 pm
Página 3 / 3