ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Specialized Cell Formatting (https://www.excelbanter.com/excel-discussion-misc-queries/52550-specialized-cell-formatting.html)

myrddinbach

Specialized Cell Formatting
 
I have a column that contains a string of numbers, but I need to have
it formatted in a customized way using a few .'s. And I want to know if
there is any way I can set the formatting for this column so that it
will automatically change all the cells in this column without me
having ot manually do it.

Here's an example of what I need:
In each column a string of numbers like:

123456789012345

The string of numbers need to be formatted like so:

123456.78.901234.5

The column is already filled with numbers in the first example.
Can I somehow automate the formatting of this string of numbers so it
will automatically change them as in the second example?


Ian

Specialized Cell Formatting
 
Sub addpoints()
For r = 1 To 20 ' change row range to suit
d = Cells(r, "A").Value ' change column letter to suit
Cells(r, "A").Value = Left(d, 6) & "." & Mid(d, 7, 2) & "." & Mid(d, 9, 6) &
"." & Right(d, 1) ' change column letter to suit
Next r
End Sub


--
Ian
--
"myrddinbach" wrote in message
ups.com...
I have a column that contains a string of numbers, but I need to have
it formatted in a customized way using a few .'s. And I want to know if
there is any way I can set the formatting for this column so that it
will automatically change all the cells in this column without me
having ot manually do it.

Here's an example of what I need:
In each column a string of numbers like:

123456789012345

The string of numbers need to be formatted like so:

123456.78.901234.5

The column is already filled with numbers in the first example.
Can I somehow automate the formatting of this string of numbers so it
will automatically change them as in the second example?




Sloth

Specialized Cell Formatting
 
Use a custom format of

######\.##\.######\.#

or

000000\.00\.000000\.0

The second one keeps leading zeros

Example:
000456789012345
456.78.901234.5
or
000456.78.901234.5

"myrddinbach" wrote:

I have a column that contains a string of numbers, but I need to have
it formatted in a customized way using a few .'s. And I want to know if
there is any way I can set the formatting for this column so that it
will automatically change all the cells in this column without me
having ot manually do it.

Here's an example of what I need:
In each column a string of numbers like:

123456789012345

The string of numbers need to be formatted like so:

123456.78.901234.5

The column is already filled with numbers in the first example.
Can I somehow automate the formatting of this string of numbers so it
will automatically change them as in the second example?



JE McGimpsey

Specialized Cell Formatting
 
One way:

Format/Cells/Number/Custom 000000\.00\.000000\.0


In article . com,
"myrddinbach" wrote:

I have a column that contains a string of numbers, but I need to have
it formatted in a customized way using a few .'s. And I want to know if
there is any way I can set the formatting for this column so that it
will automatically change all the cells in this column without me
having ot manually do it.

Here's an example of what I need:
In each column a string of numbers like:

123456789012345

The string of numbers need to be formatted like so:

123456.78.901234.5

The column is already filled with numbers in the first example.
Can I somehow automate the formatting of this string of numbers so it
will automatically change them as in the second example?



All times are GMT +1. The time now is 12:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com