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