Macro - Replace cells if filter "ends with" criteria met

gigioo7

New Member
Joined
Apr 13, 2011
Messages
1
Hello Guys,

This is my first post here, i've spent the whole day searching through the forums and there are a lot of interesting things here, keep up the good work.

I have a worksheet with multiple columns. (Issue Date, Price, Qty, Product, Client Name etc) and about 11.000 rows.

I was trying to find a simple macro that will allow me to replace the cells (text) that end with ABC, on a single column - the client name, with SUBSCRIPTION.

So far i managed to adapt by replacing items one by one , but it's not very elegant.




sub ReplaceSUBSCRIPTION()

Cells.Replace What:="JOHNSON-ABC", Replacement:="SUBSCRIPTION", LookAt:=xlPart, SearchOrder:=xlByRows
Cells.Replace What:="MARTIN-ABC", Replacement:="SUBSCRIPTION", LookAt:=xlPart, SearchOrder:=xlByRows

End Sub


How can it be done automatically?
Thank you!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi, welcome to the board.

I'm not a macro expert, but maybe a wildcard character such as * would help.
For example
Code:
Cells.Replace What:="*-ABC", Replacement:...............

Certainly the standard Edit, Find and Replace functionality works this way outside macros.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,728
Members
452,939
Latest member
WCrawford

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