Please have a look and see if my inquiry makes sense....thanks guys!!!

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
The code below seaches whatever words is entered in cell "A1", simply control+f thing...what i want here is that everytime i hit enter it searches the next result, i want that to be highted temporarily with any colour say blue....so that it makes my work easy to locate. Thanks
in simplr word hilight the search result with colour, but when the search move to the other cell it should not leave the colour behind. thanks

Sub Macro2()
'find the word in cell a1
Cells.Find(What:=Range("A1").Value, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
:help::help::help:

4 of us shouting for more help!!!

When i ctrl+f and search by macro how can i preview it with colour....


Thanks again!!!;)
 
Upvote 0
Try this:

Code:
'Clears the cell of the color before searching
ActiveCell.Interior.Color = xlNone
 
'Search for value in A1 
Cells.Find(What:=Range("A1").Value, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
 
'Colors the cell blue if result found
ActiveCell.Interior.Color = RGB(0, 0, 255)
 
Upvote 0
Was out of site yesterday so couldn't test the code...i hope this will work.

Thanks:)
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top