Find and Mark

jackt05

Board Regular
Joined
Feb 1, 2009
Messages
194
Hi friends,

I have to manually enter the code nos. of the hard copy to find the code in the soft copy. After finding the number, I wish to mark it as so that double work should not be done or to find which code's hard copy is not with me.
I am using Find and Replace to find the number and after it is found I have to click the replace tab to enter colour in it.
Is there any auto function to mark as soon as I find the required number instead of clicking the replace tab to save my time.

Regards and thanks in advance
 
Try

Rich (BB code):
Sub FindHighlight()
Dim tempCell As Range, Found As Range, FoundRange As Range, sTxt As String
sTxt = InputBox("Search string")
If sTxt = "False" Then Exit Sub
Set Found = Range("A1")
Set tempCell = Cells.Find(what:=sTxt, After:=Found, SearchDirection:=xlNext, MatchCase:=False, lookat:=xlWhole)
If tempCell Is Nothing Then
    MsgBox prompt:="Not found", Title:="Finder"
    Exit Sub
Else
    Set Found = tempCell
    Set FoundRange = Found
End If
Do
    Set tempCell = Cells.FindNext(After:=Found)
    If Found.Row >= tempCell.Row Then Exit Do
    Set Found = tempCell
    Set FoundRange = Application.Union(FoundRange, Found)
Loop
FoundRange.Interior.ColorIndex = 6
FoundRange.Font.ColorIndex = 3
End Sub
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Now it is exactly highlighting the given no.,

can I find the nos. only in column B how can that be done and will the cursor not select the cell found.

thanks for the reply
 
Upvote 0
Try

Code:
Sub FindHighlight()
Dim tempCell As Range, Found As Range, FoundRange As Range, sTxt As String
sTxt = InputBox("Search string")
If sTxt = "False" Then Exit Sub
Set Found = Range("B1")
Set tempCell = Columns("B").Find(what:=sTxt, After:=Found, SearchDirection:=xlNext, MatchCase:=False, lookat:=xlWhole)
If tempCell Is Nothing Then
    MsgBox prompt:="Not found", Title:="Finder"
    Exit Sub
Else
    Set Found = tempCell
    Set FoundRange = Found
End If
Do
    Set tempCell = Columns("B").FindNext(After:=Found)
    If Found.Row >= tempCell.Row Then Exit Do
    Set Found = tempCell
    Set FoundRange = Application.Union(FoundRange, Found)
Loop
With FoundRange
    .Interior.ColorIndex = 6
    .Font.ColorIndex = 3
    .Select
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,179
Messages
6,123,495
Members
449,100
Latest member
sktz

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