Notifications
Clear all

Mostrar valores desconsiderando linhas em branco

7 Posts
3 Usuários
0 Reactions
1,279 Visualizações
(@geise)
Posts: 0
New Member
Topic starter
 

Boa noite

gostaria que este formulário não está mostrando todas as informações da coluna 1, o que fazer para que ele desconsidere as linhas em branco para mostrar todos os dados existentes

 
Postado : 02/05/2017 7:57 pm
(@brunoxro)
Posts: 0
New Member
 

Boa noite,

Substitua as Subs 'PreencheLista' e 'PreencheLista2' por essas:

Private Sub PreencheLista()
    
    ThisWorkbook.Activate
    
    Dim Ws              As Worksheet
    Dim i               As Double
    Dim Nlin            As Double
    Dim TextoCelula     As String
    
    Set Ws = ThisWorkbook.Worksheets(1)
    
    Nlin = Ws.Range("A1048575").End(xlUp).Row
    ListProduto.Clear
    
    With Ws
        
        For i = 4 To Nlin
            
            If .Cells(i, 2).Value <> Empty And .Cells(i, 1) <> Empty Then
                TextoCelula = .Cells(i, 2).Value
                If UCase(Left(TextoCelula, Len(TextoDigitado))) = UCase(TextoDigitado) Then
                    ListProduto.AddItem .Cells(i, 2)
                End If
            
            End If
        
        Next i
        
    End With

End Sub

Private Sub PreencheLista2()
    
    ThisWorkbook.Activate
    
    Dim Ws                 As Worksheet
    Dim i                     As Double
    Dim Nlin                 As Double
    Dim TextoCelula     As String
    
    Set Ws = ThisWorkbook.Worksheets(1)
    
    Nlin = Ws.Range("A1048575").End(xlUp).Row
    ListCodigo.Clear
    
    With Ws
    
        For i = 4 To Nlin
                
            If .Cells(i, 2).Value <> Empty And .Cells(i, 1) <> Empty Then
                TextoCelula = .Cells(i, 1).Value
                If UCase(Left(TextoCelula, Len(TextoDigitado))) = UCase(TextoDigitado) Then
                    ListCodigo.AddItem .Cells(i, 1)
                End If
            
            End If
            
        Next i
    
    End With
    
End Sub

att,

 
Postado : 02/05/2017 9:04 pm
(@geise)
Posts: 0
New Member
Topic starter
 

Bom dia

O código funcionou parcialmente, quando seleciono ele não aparece o produto referente a ele na TexBox.

 
Postado : 03/05/2017 3:03 am
(@wagner-morel-vidal-nobre)
Posts: 4063
Famed Member
 

Geise,

Bom dia!

Segue seu arquivo com pequenas correções.

 
Postado : 03/05/2017 8:35 am
(@geise)
Posts: 0
New Member
Topic starter
 

Boa tarde,Wagner

preciso que somente seja ocultada a linha a respeito do código

 
Postado : 03/05/2017 2:35 pm
(@wagner-morel-vidal-nobre)
Posts: 4063
Famed Member
 

Não entendi...

 
Postado : 03/05/2017 4:05 pm
(@geise)
Posts: 0
New Member
Topic starter
 

Obrigada pela ajuda

resolvi preenchendo as linhas em branco com qualquer valor

 
Postado : 03/05/2017 7:33 pm