Notifications
Clear all

Filtro em listview

4 Posts
2 Usuários
0 Reactions
1,454 Visualizações
(@betorubini)
Posts: 57
Trusted Member
Topic starter
 

estou tentando fazer um filtro numa listview, usando o código

Private Sub txtbucafornecedor_Change()
    LastRow = Plan2.Cells(Rows.Count, "a").End(xlUp).Row
    ListViewFORNECEDOR.ListItems.Clear
    
    ' Adiciona itens
    For x = 2 To LastRow
    
    If UCase(Plan2.Cells(x, 3)) Like "*" & UCase(txtbucafornecedor) & "*" Then
    Set li = ListViewFORNECEDOR.ListItems.Add(Text:=Plan2.Cells(x, "a").Value)
    li.ListSubItems.Add Text:=Plan2.Cells(x, "c").Value
    Exit Sub
    End If
    Next
End Sub

mas queria quado quando apagasse o texto da "txtbuscafornecedor" a listview fosse limpa

tentei usar

i txtbucafornecedor = "" then
ListViewFORNECEDOR.ListItems.Clear

mas ainda sobra no listview os dados da linha 2
não sei se estou fazendo errado ,sealguem puder me ajuda
Obrigado

 
Postado : 17/09/2012 6:26 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Anexe modelo compactado.

 
Postado : 17/09/2012 6:52 am
(@betorubini)
Posts: 57
Trusted Member
Topic starter
 

Segue o modelo

na verdade eu queria conseguir preencher o lisviewFornecedor sem cabeçalho e somente se eu fizesse uma pesquisa
ai seria preenchido somente pelo fornecedor pesquisado, e quando nao pesquisasse nada o listviewficaria em vazio

 
Postado : 17/09/2012 9:11 am
(@betorubini)
Posts: 57
Trusted Member
Topic starter
 

Alguém pode me dar um help?
obrigado!

 
Postado : 18/09/2012 1:39 pm