Custom Cell Formatting

jay86

New Member
Joined
Jul 22, 2011
Messages
3
Hi there,
I'm new to the board so hi to all. I just had a quick question about formatting a cell. I wanted to see if I could save a custom format for the way a number is displayed in any given cell. In my case I have a 15 digit number that I would like to change to display differently. Of course, I wanted to do this without having to use a macro but I might not have a choice.

An example of what I'm trying to do is change 49033111110000 to display as 049-033-11111

I tried using a macro for this, but I could not get it to apply this same formatting for a range of cells since the range is not constant. What I wanted to see is if there was a way to save a customized format for a cell that could be applied to other cells for later. I know I might just have to tinker around with a macro later, but I wanted to see if something like this is possible with Excel 2007.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Do this ~ in a spare cell type 10000, copy that cell then select all cells with those numbers you wish to format.

then ~ paste special, values, divide. That gets rid of the 0000's

Then select all cells with your number in them, then in custom format type ~
"0"#"-"###"-"#####

then ok.
 
Upvote 0
If you do want to attach it to a Macro so you can highlight a range and apply the custom format to all values in the range:

Sub 15_Char_Format()
'
' 15_Char_Format Macro
' Formats Cells to with hyphen
'
'
Selection.NumberFormat = ""0"#"-"###"-"#####"
End Sub

Once you have created the macro you can attached is to a button and then just click the button when you want to use the format.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top