find and replace only within selection

frustrated_macro

New Member
Joined
Sep 4, 2019
Messages
49
Office Version
  1. 365
Platform
  1. Windows
So i have data in columns A and B which are exact. im trying to replace the text JUST in column A from X to Z and i thought it had been working but i just realized its grabbing the text in column B and replacing it too.

I cant have it replace what is in B because that is the true final text. im just using column A text to group categories together to later use the FILTER function



what am i doing wrong?



Columns("A:A").Select

Selection.Replace What:="Example Text", Replacement:="AS & TNT", LookAt _

:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
When I run your code it only replaces the text "Example Text" in column A. The same text in other columns is untouched. Please show all of your code.

column A from X to Z
What does this mean?
 
Upvote 0
I agree with Jeff @6StringJazzer that it works as you are intending.
Is there any chance that you have a formula in Column B that is bringing in the value from Column A, so that the change in A if flowing through ?
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: find and replace only within selection - OzGrid Free Excel/VBA Help Forum
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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