calbais
asked on
How to put dashes (-) after every third number?
I have documents that consists of a table on each page where I have to type in numbers in this format (###-###-###). I would like to just type in the numbers and then run a macro that would automatically enter the dashes.
I would like the macro to run from a command button on the right side of the first page but it can't print when the page is printed if that is possible!
I've attached a copy of the file I use to enter the numbers.
Thanks in advance for any help!
2011Box1-000-020-.doc
I would like the macro to run from a command button on the right side of the first page but it can't print when the page is printed if that is possible!
I've attached a copy of the file I use to enter the numbers.
Thanks in advance for any help!
2011Box1-000-020-.doc
Alternatively, you could embed an Excel spreadsheet in the Word document (or just use Excel) and set the number format in Excel.
To do this in Word 2010, click on the arrow next to Insert Table, then choose Excel Spreadsheet.
Then select the relevant cells in the (Excel) table, right-click and choose Format, select Custom and type in the format as 000-000-000.
The numbers will then automatically be displayed in your desired format.
To do this in Word 2010, click on the arrow next to Insert Table, then choose Excel Spreadsheet.
Then select the relevant cells in the (Excel) table, right-click and choose Format, select Custom and type in the format as 000-000-000.
The numbers will then automatically be displayed in your desired format.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Pfsnet... I would love to use Excel since I'm more familiar with it but I have no control over that at work. We have to use the Word document they provide. Thanks though!
GrahamSkan... I'm going to give your macro idea a try at work today. That looks like what I want. I'm using Word 2010. I'll put a button on the ribbon to activate the macro.
Thanks for your suggestion!
GrahamSkan... I'm going to give your macro idea a try at work today. That looks like what I want. I'm using Word 2010. I'll put a button on the ribbon to activate the macro.
Thanks for your suggestion!
ASKER
Thanks GrahamSkan. That macro works perfectly!!
I put a button on the ribbon so it would always be available to click but when I gave the document to a co-worker, the button was missing. Do you know if there is a way to make the button stay active when the document is distributed to someone else?
Regards
Cal
I put a button on the ribbon so it would always be available to click but when I gave the document to a co-worker, the button was missing. Do you know if there is a way to make the button stay active when the document is distributed to someone else?
Regards
Cal
You would have to put the code and the keystroke in the document - or in its attached template which would also have to be distributed to your colleague.
ASKER
Yeah, I did that but it didn't work!
Anyway, I'll figure it out. You answered my question here so here's your points.
Thanks for your help.
Regards
Cal
Anyway, I'll figure it out. You answered my question here so here's your points.
Thanks for your help.
Regards
Cal
ASKER
GrahamSkan answered quickly and accurately. His solution worked perfectly the first time!!
Thanks very much!
Thanks very much!
Find: <([0-9]{3})([0-9]{3})([0-9
Replace: \1-\2-\3
This is a good article on Word wildcards:
http://word.mvps.org/FAQs/General/UsingWildcards.htm