Macro for Trimming

G

Guest

Hello All,

Please help me to trim a file with more than 1000 email Ids.
It is in the below form
xxxxx xxxxxxx<[email protected]>

from the above mentioned form I should get only the perfect email Id. (i.e)
xxxxx xxxxxxx<[email protected]> = (e-mail address removed)

Please help me to build this Macro. It will be very helpful for me.

Thanx in Advance.
Madhan
 
D

Die_Another_Day

Sub ReplaceMacro()
Cells.Replace What:="*<", Replacement:="", LookAt:=xlPart,
SearchOrder _
:=xlByRows, MatchCase:=True, SearchFormat:=False,
ReplaceFormat:=False
Cells.Replace What:=">", Replacement:="", LookAt:=xlPart,
SearchOrder:= _
xlByRows, MatchCase:=True, SearchFormat:=False,
ReplaceFormat:=False
End Sub

HTH

Die_Another_Day
 
G

Guest

I am not sure if you really need a macro for this.
If your data is in column A, put this in cell B1 and extend the formula all
the way down column B
=MID(A1,FIND("<",A1)+1,LEN(A1)-FIND("<",A1)-1)
Hope that helps you!
 
G

Guest

Hi Allllen,

thanx a lot,

It worked well.


can One more thing added to that

xxxxx xxxxxxx<[email protected]> = (e-mail address removed)
in the above case it worked well.

one more thing can be added to that (i.e)
xxxxx xxxxxxx<[email protected]>, = (e-mail address removed) in this case that is If
a comma(i.e more than one character) is there in front or at the end of the
angular brackets it is not working is there any solution for this.

If so pls let me know. thanx in advance.
Madhan
 
D

Die_Another_Day

Change this:
=MID(A1,FIND("<",A1)+1,LEN(A1)-FIND("<",A1)-1)
to this:
=MID(A1,FIND("<",A1)+1,FIND(">",A1)-FIND("<",A1)-1)

HTH

Die_Another_Day
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top