Hello friends, I have this code that does a search in the entire worksheet seeking value in a range of column D, I need it to check if column B there is anything typed in, if blank, even if column B contains the item searched him to jump to the next:
Private Sub PESQUISAR_Click()
Dim i As Integer
Dim PES As Variant
Dim ws As Worksheet
Dim rg As Range
PES = Application.InputBox("Informe valor a ser pesquisado.", "LABORATÓRIO LCQ.")
For Each ws In ActiveWorkbook.Worksheets
For Each rg In ws.[D1:D80]
If rg = PES Then i = i + 1
Next rg
Next ws
txtqt.Value = i ' Amount found in the research
txtname.Value = PES ' Name search
End Sub
Att
Osmarls
Private Sub PESQUISAR_Click()
Dim i As Integer
Dim PES As Variant
Dim ws As Worksheet
Dim rg As Range
PES = Application.InputBox("Informe valor a ser pesquisado.", "LABORATÓRIO LCQ.")
For Each ws In ActiveWorkbook.Worksheets
For Each rg In ws.[D1:D80]
If rg = PES Then i = i + 1
Next rg
Next ws
txtqt.Value = i ' Amount found in the research
txtname.Value = PES ' Name search
End Sub
Att
Osmarls