Find and replace only the whole number in Excel

rufuswrong

New Member
Joined
Sep 6, 2011
Messages
1
hello

I am using the find and replace (Cntrl F) in a worksheet but am being frustrated by being unable to get excel to only replace the exact number not the derivatives.

EG I wish to search for all HS10 and replace with S70 but in addition to HS10 excel wants to replce anything starting with HS10 like HS101 or HS100345. How can I get it to only selec HS10 and nothing except HS 1?

Thanks a lot
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Welcome to the forum, try something like this via code

Sub replace1()
Dim rep As String
Dim newrep As String
rep = "HS10"
newrep = "S70"
For Each cell In Range("A1:IV600")
If cell.Value = rep Then
cell.Value = newrep
End If
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,136
Members
452,890
Latest member
Nikhil Ramesh

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