Hello guys, I have a problem. When I press the enter key to run my macro it works but only the cell A5 is active.
This macro executed by enter key runs an advanced search on A5:G5. it may contain several criteria or just one but when I write on B5:G5 it does not work.
The advanced search macro
Public Sub Pesquisa()
If ActiveCell.Row = 5 Then
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
End If
End Sub
The enter key macro
Public Sub confpesq(ByVal Target As Range)
If Target.Address = "$A$5:$G$5" Then
Call Pesquisa
End If
End Sub
Bookmarks