Notifications
Clear all

Filtro de listbox "Acerto"

3 Posts
3 Usuários
0 Reactions
476 Visualizações
(@atoledo)
Posts: 0
New Member
Topic starter
 

Prezados boa tarde.
Há possibilidade de adaptar algo a este código?

Hj ao realizar a procura do que foi digitado no textbox, ele procura e recarrega ao listbox4 apenas os dados que encontra até uma linha em branco. Quando ele encontra essa linha em branco carrega apenas até ela.

Ha como fazer que ele ignore a linha em branco e carregue todos os dados? Mas mantendo ou modificando esse código, pois uso ele como um filtro duplo.

Obrigado.

Private Sub txt1_Change()

Dim guia As Worksheet
Dim valor_celula, linha, linhalistbox As Integer
Set guia = Plan1
linhalistbox = 0
linha = 2
ListBox4.Clear
With guia

While .Cells(linha, 2).Value <> Empty

 

valor_celula = .Cells(linha, 3).Value
If UCase(Left(valor_celula, Len(txt1.Text))) = UCase(txt1.Text) Then ' campus

 

valor_celula = .Cells(linha, 9).Value
If UCase(Left(valor_celula, Len(txt2.Text))) = UCase(txt2.Text) Then ' cpf


valor_celula = .Cells(linha, 39).Value
If UCase(Left(valor_celula, Len(txt3.Text))) = UCase(txt3.Text) Then ' data

valor_celula = .Cells(linha, 40).Value
If UCase(Left(valor_celula, Len(txt4.Text))) = UCase(txt4.Text) Then ' situacao

With ListBox4
.AddItem

.List(linhalistbox, 0) = guia.Cells(linha, 1)
.List(linhalistbox, 1) = guia.Cells(linha, 2)
.List(linhalistbox, 2) = guia.Cells(linha, 4)
.List(linhalistbox, 3) = guia.Cells(linha, 9)
.List(linhalistbox, 4) = guia.Cells(linha, 22)
.List(linhalistbox, 5) = guia.Cells(linha, 25)
.List(linhalistbox, 6) = guia.Cells(linha, 39)
.List(linhalistbox, 7) = guia.Cells(linha, 40)

End With
linhalistbox = linhalistbox + 1
End If
End If
End If
End If

linha = linha + 1

Wend

End With

End Sub
 
Postado : 19/05/2016 10:41 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Boa tarde Atoledo

Como você é novato no fórum, para facilitar a tua participação, sugiro tomar conhecimento do conteúdo dos links abaixo:
viewtopic.php?f=7&t=203
viewtopic.php?f=7&t=7903
viewtopic.php?f=7&t=3841
viewtopic.php?f=7&t=16757
viewtopic.php?f=7&t=12600
viewtopic.php?f=7&t=3371

[]s
Patropi - Moderador

 
Postado : 19/05/2016 10:43 am
(@osvaldomp)
Posts: 857
Prominent Member