Boa noite.
Realizei uma adaptação em um código fonte, porém não estou conseguindo descobrir aonde encontra-se a informação na qual desejo mudar.
Quando digito o nome na textbox, desejo que ela procure a partir da linha dois, e também não apareça na listbox dados da ultima coluna (Email)
Sub FindAllMatches()
'Find all matches on activesheet
'Called by: TextBox_Find_KeyUp event
Dim SearchRange As Range
Dim FindWhat As Variant
Dim FoundCells As Range
Dim FoundCell As Range
Dim arrResults() As Variant
Dim lFound As Long
Dim lSearchCol As Long
Dim lLastRow As Long
If Len(Cadastro_Fornecedor.Txt_Consulta.Value) > 1 Then 'Do search if text in find box is longer than 1 character.
Set SearchRange = ActiveSheet.UsedRange.Cells
FindWhat = Cadastro_Fornecedor.Txt_Consulta.Value
'Calls the FindAll function
Set FoundCells = FindAll(SearchRange:=SearchRange, _
FindWhat:=FindWhat, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
MatchCase:=False, _
BeginsWith:=vbNullString, _
EndsWith:=vbNullString, _
BeginEndCompare:=vbTextCompare)
If FoundCells Is Nothing Then
ReDim arrResults(1 To 1, 2 To 2)
arrResults(1, 1) = "No Results"
arrResults(1, 2) = "No Results"
Else
'Add results of FindAll to an array
ReDim arrResults(1 To FoundCells.Count, 1 To 2)
lFound = 1
For Each FoundCell In FoundCells
arrResults(lFound, 1) = FoundCell.Value
arrResults(lFound, 2) = FoundCell.Address
lFound = lFound + 1
Next FoundCell
End If
'Populate the listbox with the array
Me.Lista_Fornecedor.List = arrResults
Else
Me.Lista_Fornecedor.Clear
End If
End Sub
Postado : 02/09/2018 5:52 pm