Excel JUMP FROM SEARCH BAR TO RESULT

Joined
Nov 12, 2019
Messages
3
Reaction score
1
HI THERE
IS THERE A WAY I CAN JUMP FROM THE SEARCH CELL TO THE RESULT OF THAT SPECIFIC SEARCH? ALL THE SEARCH CELL DOES IS HIGHLIGHT THE RESULT IN THE RANGE I HAVE NAMED AND FORMATTED(CONDITIONAL) FOR THIS.

FOR EXAMPLE:
NAMED RANGE = A2 TO C10 (DATA IN CELLS ARE NUMBERS 1 - 30)
SEARCH CELL = E1
IF I TYPE "17" IN TO SEARCH CELL(E1) AND PRESS ENTER, IT HIGHLIGHTS B7(17). INSTEAD OF DONG THIS I WANT IT TO JUMP FROM THE SEARCH BAR TO B7 WHEN I PRESS INTER. BASICALLY I WANT IT TO JUMP TO THE CELL THAT I SEARCH FOR NOT JUST HIGHLIGHT IT.
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$1" Then
srch = Format(Target, "0")
Columns("A:C").Select
Selection.Find(What:=srch, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate

ActiveCell.Offset(0, 0).Select
End If
End Sub

Attached is an excel file which I tested the code with.
 

Attachments

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$1" Then
srch = Format(Target, "0")
Columns("A:C").Select
Selection.Find(What:=srch, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate

ActiveCell.Offset(0, 0).Select
End If
End Sub

Attached is an excel file which I tested the code with.
THANKS A MILLION
WHERE DO I WRITE THIS CODE?
STILL LEARNING LOL
 
Right click on the sheet tab (probably in the bottom left of the screen)
A menu would popup

From that menu choose View Code

This will bring a white vba code area

Paste the code there.
 
Back
Top