Anglais428v2
New Member
- Joined
- Jun 19, 2020
- Messages
- 27
- Office Version
- 365
- Platform
- Windows
I have a list of company names in range G2:G30000. I want to replace certain suffix (e.g. Inc, GmBH etc.) from their names. I have a list of suffix in range B2:B500 (cell B2 is '& Co' for example)
I have a macro that works well but for only the first instance and I need it to be dynamic:
Range("G2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Replace What:="& CO*", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.End(xlUp).Select
Range("G2").Select
Note I am using the asterix after the text & CO as I want to replace any text to the right of '& CO'.
What I need is the above put into a loop and replace the "What= "& CO*" with the cell reference B2 ('& CO' is housed within cell B2). I then want the function to loop and go to cell B3 (which contains '(Pty) Ltd'), do the replace and so on until cell B500.
Any advise?
Thanks
I have a macro that works well but for only the first instance and I need it to be dynamic:
Range("G2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Replace What:="& CO*", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.End(xlUp).Select
Range("G2").Select
Note I am using the asterix after the text & CO as I want to replace any text to the right of '& CO'.
What I need is the above put into a loop and replace the "What= "& CO*" with the cell reference B2 ('& CO' is housed within cell B2). I then want the function to loop and go to cell B3 (which contains '(Pty) Ltd'), do the replace and so on until cell B500.
Any advise?
Thanks