- 11 Mar 2022 às 14:49
#69588
Acrescente o filtro no IF, dessa forma:
If ws.Cells(Linha, 2) >= CDate(TxtDataInicio.Value) And Cells(Linha, 2) <= CDate(TxtDataFinal.Value) _
And ws.Cells(Linha, 10) = "Concluido" Then
Código Completo:
Dim Linha, LinhaListbox As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("tbchamados")
Linha = 2
LinhaListbox = 0
ListBoxConcluidos.Clear
With ws
While ws.Cells(Linha, 1).Value <> Empty
If ws.Cells(Linha, 2) >= CDate(TxtDataInicio.Value) And Cells(Linha, 2) <= CDate(TxtDataFinal.Value) _
And ws.Cells(Linha, 10) = "Concluido" Then
With FormConcluidos.ListBoxConcluidos
.AddItem
.List(LinhaListbox, 0) = ws.Cells(Linha, 1) 'codigo 'A
.List(LinhaListbox, 1) = ws.Cells(Linha, 5) 'descrição 'E
.List(LinhaListbox, 2) = ws.Cells(Linha, 2) 'data "B
.List(LinhaListbox, 3) = ws.Cells(Linha, 4) 'prioridade 'D
.List(LinhaListbox, 4) = ws.Cells(Linha, 6) 'patrimonio 'F
.List(LinhaListbox, 5) = ws.Cells(Linha, 7) 'solicitante 'G
.List(LinhaListbox, 6) = ws.Cells(Linha, 8) 'secretaria "H
.List(LinhaListbox, 7) = ws.Cells(Linha, 12) 'tecnico "L
.List(LinhaListbox, 8) = ws.Cells(Linha, 10) 'status " 'J
.List(LinhaListbox, 9) = ws.Cells(Linha, 14) 'parecer tecnico 'N
LinhaListbox = LinhaListbox + 1
End With
End If
Linha = Linha + 1
Wend
End With
Pedro Henrique Sabater