Galera, bom dia
Eu localizei um código na web, mas ainda assim o formulário não lista os resultados que estão nas outras abas. Vocês poderiam me ajudar?
Sub gsLocalizarAvancado()
frmPesquisaAvancada.Show
End Sub
Private Sub CommandButton1_Click()
Dim currentFind As Excel.Range
Dim firstFind As Excel.Range
Dim lQtdePlan As Integer
Dim lPlanAtual As Integer
Dim lPlanFim As Boolean
lQtdePlan = Worksheets.Count
lPlanAtual = 1
lPlanFim = False
listResultado.Clear
While lPlanAtual <= lQtdePlan
Set currentFind = Worksheets(lPlanAtual).Range("A1:XFD1048576").Find(txtPesquisa.Text, , _
Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, _
Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False)
Set firstFind = Nothing
While Not currentFind Is Nothing And lPlanFim = False
If firstFind Is Nothing Then
Set firstFind = currentFind
ElseIf currentFind.Address = firstFind.Address Then
lPlanFim = True
End If
If lPlanFim = False Then
Set currentFind = Worksheets(lPlanAtual).Range("A1:XFD1048576").FindNext(currentFind)
listResultado.AddItem (Worksheets(lPlanAtual).Name & "!" & currentFind.Address)
End If
Wend
lPlanAtual = lPlanAtual + 1
lPlanFim = False
Wend
Sair:
Exit Sub
End Sub
Private Sub listResultado_Click()
Dim lRng As Range
Dim lEndereco() As String
lEndereco = Split(listResultado, "!")
Worksheets(lEndereco(0)).Activate
Set lRng = Range(lEndereco(1))
lRng.Activate
End Sub
Postado : 09/09/2013 8:47 am