tourless

Board Regular
Joined
Feb 8, 2007
Messages
140
Office Version
  1. 365
Platform
  1. Windows
Hi Folks,

I have a list of customers in column A. All of them start with "zz" which is simple enough to remove using...
Range("A2:A" & lRow).Replace what:="zz", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True, _
SearchFormat:=False, ReplaceFormat:=False
In that same list there are a variety of possible ending characters that I would like to remove as well. Some customers end with just their name which is fine. Others might end with "***OOB" or "***PO" or "***QT" or some variety therein. What I would like to do is any time the * character is found, remove it and anything that comes after it. I've tried variations on the following with no luck so far...
Range("A2:A" & lRow).Replace what:="(*)", Replacement:="", LookAt:=xlPart

UPDATE:
This has gotten me closer...
Range("A2:A" & lRow).Replace what:=" ~*", Replacement:="", LookAt:=xlPart

TIA!
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
How about
Code:
Range("A2:A" & LRow).Replace "~**", "", xlPart, , False, , False
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
You need a minor tweak to your code: use Range("A2:A" & lRow).Replace what:=" ~**", Replacement:="", LookAt:=xlPart
 
Upvote 0

Forum statistics

Threads
1,213,564
Messages
6,114,334
Members
448,567
Latest member
Kuldeep90

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