You are on page 1of 3

EstaPasta_de_trabalho - 1

Dim MyVetor() As Vetor


Private Type Vetor
texto As String
End Type

Public Function limpar_linhas()

Sheets("receita").Select
Sheets("receita").Range("B4").Select
Selection.ClearContents

Sheets("receita").Range("B8:B27").Select
Selection.ClearContents

Sheets("receita").Range("B31:B60").Select
Selection.ClearContents

Sheets("receita").Range("B64").Select
Selection.ClearContents

Sheets("receita").Range("G64").Select
Selection.ClearContents

Sheets("receita").Range("L64").Select
Selection.ClearContents

Sheets("receita").Range("B68").Select
Selection.ClearContents

Sheets("receita").Range("d68").Select
Selection.ClearContents

Sheets("receita").Range("g68").Select
Selection.ClearContents

Sheets("receita").Range("j68").Select
Selection.ClearContents

Sheets("receita").Range("B72:B76").Select
Selection.ClearContents

Sheets("receita").Range("B4").Select

End Function

Public Function excluir_linhas(vlin As Double)


Sheets("dados").Select
Sheets("dados").Rows(CStr(vlin) + ":" + CStr(vlin)).Select
Selection.Delete Shift:=xlUp
Sheets("dados").Range("A1").Select
Sheets("receita").Select
End Function

Private Sub Workbook_Open()

x = todas_as_receitas
Sheets("inicio").Select
End Sub
EstaPasta_de_trabalho - 2

Public Function todas_as_receitas()

Plan4.ListBox1.Clear
Plan4.ListBox2.Clear

vlinha_final = Sheets("dados").Cells.Find("*", [a1], , , , xlPrevious).Row


For i = 2 To vlinha_final
vlinha = i
vnome = Sheets("dados").Range("A" + CStr(i)).Value
Plan4.ListBox1.AddItem vnome
Plan4.ListBox2.AddItem vlinha
Next
Plan4.txt_pesquisa.Text = ""
End Function

Public Function pesquisa()

Vetor = 0

vaux = UCase(Plan4.txt_pesquisa.Text) + ","


vresp = ""
For i = 1 To Len(vaux)
vresp = LTrim(RTrim(vresp + Mid(vaux, i, 1)))

If Mid(vaux, i, 1) = "," Then


If Len(vresp) > 1 Then

ReDim Preserve MyVetor(Vetor)


MyVetor(Vetor).texto = Mid(vresp, 1, Len(vresp) - 1)
Vetor = Vetor + 1
vresp = ""
End If
End If
Next

Plan4.ListBox1.Clear
Plan4.ListBox2.Clear

vlinha_final = Sheets("dados").Cells.Find("*", [a1], , , , xlPrevious).Row


For i = 2 To vlinha_final
vlinha = i
vnome = Sheets("dados").Range("A" + CStr(i)).Value
pp = 0
vinicol = 2
For j = vinicol To 20
x = Sheets("dados").Cells(vlinha, vinicol)
vinicol = vinicol + 1

For kk = 0 To Vetor - 1
tt = MyVetor(kk).texto
If InStr(UCase(x), UCase(tt)) > 0 Then
Plan4.ListBox1.AddItem vnome
Plan4.ListBox2.AddItem vlinha
pp = 1
Exit For
End If
Next
If pp = 1 Then
Exit For
End If
Next
Next

If Vetor = 0 Or vlinha_final = 1 Then


MsgBox "Nada foi localizado"
End If
EstaPasta_de_trabalho - 3

End Function

You might also like