Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I want to format cells to accept charge card numbers with the spaces.
|
#2
![]() |
|||
|
|||
![]()
Hi
with the selected cell, right click, select Format Cells, select custom, and enter "0"'s where you want digits, and spaces where you want spaces, eg"0000 0000 0000 000". While when entering it will not have spaces, it will enter correctly. "tspraetz" wrote: I want to format cells to accept charge card numbers with the spaces. |
#3
![]() |
|||
|
|||
![]()
Kassie,
I did that, but for some reason it changes the last digit to a zero. "Kassie" wrote: Hi with the selected cell, right click, select Format Cells, select custom, and enter "0"'s where you want digits, and spaces where you want spaces, eg"0000 0000 0000 000". While when entering it will not have spaces, it will enter correctly. "tspraetz" wrote: I want to format cells to accept charge card numbers with the spaces. |
#4
![]() |
|||
|
|||
![]()
Excel uses 15 digits, format as text.
knut "tspraetz" skrev i melding ... Kassie, I did that, but for some reason it changes the last digit to a zero. "Kassie" wrote: Hi with the selected cell, right click, select Format Cells, select custom, and enter "0"'s where you want digits, and spaces where you want spaces, eg"0000 0000 0000 000". While when entering it will not have spaces, it will enter correctly. "tspraetz" wrote: I want to format cells to accept charge card numbers with the spaces. |
#5
![]() |
|||
|
|||
![]()
You can format the cell as text (like DS NTE wrote).
Or you can prefix your entry with a single quote. '1234123412341234 And it'll be treated as text. tspraetz wrote: I want to format cells to accept charge card numbers with the spaces. -- Dave Peterson |
#6
![]() |
|||
|
|||
![]()
I wanted to Custom Format the cells for charge card numbers that are 16
digit. DS NTE was right about Excel usings 15 digits. Yes using "text" will not help me in this situation. Thanks "Dave Peterson" wrote: You can format the cell as text (like DS NTE wrote). Or you can prefix your entry with a single quote. '1234123412341234 And it'll be treated as text. tspraetz wrote: I want to format cells to accept charge card numbers with the spaces. -- Dave Peterson |
#7
![]() |
|||
|
|||
![]()
Yes using "text" will
not help me in this situation. Why not? Vaya con Dios, Chuck, CABGx3 "tspraetz" wrote in message ... I wanted to Custom Format the cells for charge card numbers that are 16 digit. DS NTE was right about Excel usings 15 digits. Yes using "text" will not help me in this situation. Thanks "Dave Peterson" wrote: You can format the cell as text (like DS NTE wrote). Or you can prefix your entry with a single quote. '1234123412341234 And it'll be treated as text. tspraetz wrote: I want to format cells to accept charge card numbers with the spaces. -- Dave Peterson |
#8
![]() |
|||
|
|||
![]()
The bad news is that numberformat works with numbers. If you keep your data as
numbers, you lose the 16th character. If you change the value to text (either preformatting or using the leading apostrophe), then numberformat won't work. On way around it is to use a worksheet event that does the "formatting" for you. It actually changes the value by inserting spaces. If you want to try this idea, rightclick on the worksheet tab that should have this behavior. Select view code. Paste this into the code window: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim myTempVal As Variant On Error GoTo errhandler: If Target.Cells.Count 1 Then Exit Sub If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub If IsNumeric(Target.Value) = False Then Exit Sub myTempVal = CDec(Target.Value) Application.EnableEvents = False Target.Value = Format(myTempVal, "0000 0000 0000 0000") errhandler: Application.EnableEvents = True End Sub I used all of column A in this line: If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub but you could use: If Intersect(Target, Me.Range("c7:g99")) Is Nothing Then Exit Sub But make sure whatever range you use is preformatted to text. If you leave it general, then that 16th digit is already a 0 when the code starts. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm tspraetz wrote: I wanted to Custom Format the cells for charge card numbers that are 16 digit. DS NTE was right about Excel usings 15 digits. Yes using "text" will not help me in this situation. Thanks "Dave Peterson" wrote: You can format the cell as text (like DS NTE wrote). Or you can prefix your entry with a single quote. '1234123412341234 And it'll be treated as text. tspraetz wrote: I want to format cells to accept charge card numbers with the spaces. -- Dave Peterson -- Dave Peterson |
#9
![]() |
|||
|
|||
![]()
I want to format this: 0000 0000 0000 0000 Charge Card Numer format. When you
type all the numbers down the column it would put the spaces in the number. If you select text there is no place to enter your custom format like the example above example. "CLR" wrote: Yes using "text" will not help me in this situation. Why not? Vaya con Dios, Chuck, CABGx3 "tspraetz" wrote in message ... I wanted to Custom Format the cells for charge card numbers that are 16 digit. DS NTE was right about Excel usings 15 digits. Yes using "text" will not help me in this situation. Thanks "Dave Peterson" wrote: You can format the cell as text (like DS NTE wrote). Or you can prefix your entry with a single quote. '1234123412341234 And it'll be treated as text. tspraetz wrote: I want to format cells to accept charge card numbers with the spaces. -- Dave Peterson |
#10
![]() |
|||
|
|||
![]()
OIC...........one way to "get there" would be to type each 4-digit group
into it's own column, and then CONCATENATE them together at the end with....... =A1&" "&B1&" "&C1&" "&D1 Vaya con Dios, Chuck, CABGx3 "tspraetz" wrote in message ... I want to format this: 0000 0000 0000 0000 Charge Card Numer format. When you type all the numbers down the column it would put the spaces in the number. If you select text there is no place to enter your custom format like the example above example. "CLR" wrote: Yes using "text" will not help me in this situation. Why not? Vaya con Dios, Chuck, CABGx3 "tspraetz" wrote in message ... I wanted to Custom Format the cells for charge card numbers that are 16 digit. DS NTE was right about Excel usings 15 digits. Yes using "text" will not help me in this situation. Thanks "Dave Peterson" wrote: You can format the cell as text (like DS NTE wrote). Or you can prefix your entry with a single quote. '1234123412341234 And it'll be treated as text. tspraetz wrote: I want to format cells to accept charge card numbers with the spaces. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Format numbers in chart datatable | Charts and Charting in Excel | |||
Checking Winning Numbers in the Lottery. | Excel Discussion (Misc queries) | |||
Converting Numbers to Text properly | Excel Discussion (Misc queries) | |||
Converting numbers to date format from csv files | Excel Discussion (Misc queries) | |||
finance charge on credit card | Excel Worksheet Functions |