Hello guys, I'm new here!
I've created an event key to run another macro. My macro does a search on the worksheet and returns values like monthly billing, store code, city and others. I write the criterion I want on A5:G5 and it returns on A6:G?? ... my problem is when I type text the macro does not work, only when I click on the search icon it does but, when I write numbers on any cell of the search the macro works perfectly and I don't need to click on search icon.
What can it be?
I've created an event key to run another macro. My macro does a search on the worksheet and returns values like monthly billing, store code, city and others. I write the criterion I want on A5:G5 and it returns on A6:G?? ... my problem is when I type text the macro does not work, only when I click on the search icon it does but, when I write numbers on any cell of the search the macro works perfectly and I don't need to click on search icon.
What can it be?
Code:
Public Sub Pesquisa()
Sheets("PESQUISA").Select
Sheets("basepes").Visible = True
Sheets("PESQUISA").Select
Sheets("basepes").Range("A1:L5900").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("PESQUISA!Criteria"), CopyToRange:=Range( _
"PESQUISA!Extract"), Unique:=False
Sheets("basepes").Select
ActiveWindow.SelectedSheets.Visible = False
Range("A5:L5").Select
Selection.ClearContents
Sheets("PESQUISA").Select
Range("A5").Select
Application.OnKey "{ENTER}", "Pesquisa"
End Sub