Stripping Numbers Down to Bare Minimum

E

Erik T. Nomad

Is there a way I can quickly apply formatting to a column of phone
numbers such that I can get rid of all spaces, dashes, slashes and
parentheses and am left with only digits? I'm currently using a "Find
and Replace" command to do this, but I'd like to find a way to save
even more time. Thanks.

E
 
S

steve

Erik,

Got this using the macro recorder and doing a quick edit to avoid the
select. With your numbers in column A (watch for word wrap)

Columns("A:A").Replace What:="-", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Columns("A:A").Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
 
E

Erik T. Nomad

Awesome. Thanks!

E

steve said:
Erik,

Got this using the macro recorder and doing a quick edit to avoid the
select. With your numbers in column A (watch for word wrap)

Columns("A:A").Replace What:="-", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Columns("A:A").Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
 
S

steve

Erik,

Thanks! Glad to be of help.

But highly recommend the recorder. It's a great way to find code.
Of course it usually includes too much and should be modified after.
Especially the selecting parts...
 

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

Top