View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
stefan via OfficeKB.com stefan via OfficeKB.com is offline
external usenet poster
 
Posts: 18
Default ccard 6 or 16 digits


Hi Paul,
Thank you for your quick answer.
I believe that the line = [Ccard].NumberFormat = "#### #### #### ####"
brings me back to the problem that excel has with numbers largen then 15
digits. If the string could become a textformat at this point i believe it
would take care of the problem. Do you know how this formating can be changed?

I guess i should have used a better example. If the user inputs
5555444433332222, excel converts it to 5555444433332220.
Thanks.
Stefan

PaulD wrote:
: Hi,
: I have cell 'C25' or range CCard in which the user may enter the first 2 and
[quoted text clipped - 9 lines]
:
: Stefan

This will do a basic check of the range CCard and format the cell
accordingly

Sub FormatCcard()
If IsNumeric([Ccard].Value) Then
If [Ccard].Formula Like "######" Then
[Ccard].NumberFormat = "##xx xxxx xxxx ####"
ElseIf [Ccard].Formula Like "################" Then
[Ccard].NumberFormat = "#### #### #### ####"
Else
MsgBox "Invalid Number"
End If
Else
MsgBox "Not a Number"
End If
End Sub

Paul D



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200507/1