Strings/suffix's in Excel

I

IainG

Hello I wonder if someone can help, I am not an expert like most of you


I have a list of email addresses in Excel

eg;

column A
------------

ABC.COM
QWE.CO.UK
RTY.COM
AAA.SSS.COM
UIY.CO.UK
SHGD.AU
etc

What I would like to do automatically is to move all the ones suffixe
with .COM or .CO.UK to another column. I guess a macro is the bes
way.

Hope someone can enlighten me
 
D

Don Guillett

something like this should move to the next column

sub movemover()
for each c in selection
if right(c,3)="COM" or right(c,2)="UK" then
c.cut c.offset(,1)
next
end sub
 
I

IainG

Hi

Thanks for a quick response. I tried that but got a error message whic
said

Compile error: Next Without for

Any idea
 
D

Don Guillett

Sorry. Was in a hurry to leave the office and forgot the end if
sub movemover()
for each c in selection
if right(c,3)="COM" or right(c,2)="UK" then
c.cut c.offset(,1)
END IF
next
end sub
 
Top