macro novice

G

Graham Hill

Help
I need to convert a large number of phone numbers from one format to
another in order to have them all the same.
When I run a macro I get the formatting changes however running the macro
causes all the numbers to change to the original that the macro was created
on. What am I doing wrong?

Thanks

Gra
 
G

Gary''s Student

You may be doing nothing wrong. The macro may have the workbook/worksheet
hard-coded. Post the macro
 
E

Ed

Hi, Graham. We can't know unless you post our code. I suspect, though,
you're going to find that you've loaded your test number into a string and
then are updating a second string but writing the first one.

Ed
 
G

Graham Hill

Here is what I'm attempting to do...


Many of the phone numbers are formatted as follows -6049852397, I need to
have them like the following (604) 985 2397,
copying the macro looks like...

Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "(604) 985 2397"
Range("N2").Select
End Sub

Does this help?

Thanks again
Gra
 
D

Dave Peterson

I would select my range of phone numbers.

Then do a series of edit|Replaces

Replace ( (Open paren) with (leave blank)
Replace ) (close paren) with (leave blank)
replace (space bar) with (leave blank)
replace - (hyphen) with (leave blank)

And any other characters that are found in your phone numbers.

After you do this, your data will be numeric.

You can use format|cells|number tab|special category
and use phone number

(Or give it a custom format that you like better)

If you really need a macro, record one when you follow those few steps.
 
Top