PHONE formatting. Is there a way to create a macro to format the VALUE of the phone to be either (XXX) XXX-XXX or XXX-XXX-XXXX ??? I obviously can get it to look like this, but the value is just XXXXXXXXXX.
Thanks much in advance!!!
PHONE formatting. Is there a way to create a macro to format the VALUE of the phone to be either (XXX) XXX-XXX or XXX-XXX-XXXX ??? I obviously can get it to look like this, but the value is just XXXXXXXXXX.
Thanks much in advance!!!
Good afternoon jreimer
You don't need to use a macro - just use a custom format.Originally Posted by jreimer
Select your cell / range.
Press Ctrl + 1.
On the number tab, goto Custom in the Category box and type one of the below into the box marked Type :
(###) ### ####
###-###-####
HTH
DominicB
Please familiarise yourself with the rules before posting. You can find them here.
that gives me the same issue - it looks correct, but the value is still XXXXXXXXXX.
Hi jreimer
If it looks correct then what's the problem? Can you elaborate?Originally Posted by jreimer
DominicB
the value of the cell is still XXXXXXXXXX not (XXX) XXX-XXXX - the format is just (XXX) XXX-XXXX - so it looks all nice and pretty, but the value of the cells is not the same.
In the cell - it looks like (XXX) XXX-XXXX, but if you click on the cell, in the bar to edit its contents - its XXXXXXXXXX (incorrect).
Hi jreimer
OK. Highlight the range you want to address and then run this macro :
Note, you can change the ###-###-#### to (###) ### #### to suit whichever format you prefer.![]()
Please Login or Register to view this content.
HTH
DominicB
That works! Beautiful!
Thanks
Well, it does work - however, when I select a column it just keeps going and going - i have to select the specific cells for it to end.
Can this be modified to work with a column selection?
Hi jreimer
Yes, but I've never seen your data so I'm working blind to a degree here, but have a go with this :Originally Posted by jreimer
This code assumes that your numbers start on row 4, and the code will go down to the end of whichever column you are in and do its stuff. You may have further requirements - if you do you may have to post a portion of your workbook so I can see how your data is structured. Let me know how you go on.![]()
Please Login or Register to view this content.
HTH
DominicB
Okay, this is working much better.
It doesn't continue to run and run. However, I do have some questions about the code itself.
The first line:![]()
Please Login or Register to view this content.
rc = Cells(65536, ActiveCell.Column).End(xlUp).Row
does this mean that it will ONLY run through 65,546 rows? This SHOULDN"T be a problem for 99.999999% of my spreadsheets - however, who knows when there will be one with more than that! I just want to know how the code works.
Also - There are times when I want to run this over multiple columns (phone AND fax) - I'm getting weird quirks when I do it over two columns. Like it will run through one column, not the other - then I run it again, and it runs it over the other columns, and changes the first one back... not really sure. Just wanted to check with you if this is MADE for just one column and if there's a way to do multiple columns.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks