ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: Samsea

[原创]与[推荐]数字金额转换中文大写与英文字母

  [复制链接]

TA的精华主题

TA的得分主题

发表于 2007-6-13 18:12 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册

http://club.excelhome.net/viewthread.php?tid=246571

怎么将美圆数值转换成英文表达?

比如:100.04 ONE HUNDREN AND FOUR CENTS

10123.15 Ten Thousand, One Hundred andTwenty-Three & FIFTEEN CENTS 

网上现有的均无法达到这个效果,请教高手.

TA的精华主题

TA的得分主题

发表于 2007-6-13 22:52 | 显示全部楼层

中文转换的有很多

不过英文转换的很少见噢

TA的精华主题

TA的得分主题

 楼主| 发表于 2007-6-16 13:06 | 显示全部楼层
我想英文转换也各不同,这个转换就是西人所用。 如果与当地习惯用法有异,只要自己更改一些字符即可。

TA的精华主题

TA的得分主题

发表于 2007-6-18 23:31 | 显示全部楼层
楼主,我下载后用不了,好不容易才下载.不过谢谢你.

TA的精华主题

TA的得分主题

发表于 2007-7-18 20:14 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2007-8-22 15:22 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2007-9-25 08:24 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2007-11-22 11:38 | 显示全部楼层

首先,谢谢帮我之前的问题,但是现在是这样的,百位与十位要用and连起来,十位与个

位用"-"符号连接起来(21以上包括21)比如:21对应的是Twenty-one 还有之前加了""符号之后

十位与个位如果是1-20包括20就不显示了,比如 112.000 对应就是

One Hundred  Dollars and No Cents 而Twelve就不见了! 不知道怎么回事,现在的要求是比如 12321.210 对应的是

Three Hundred and Twenty-One Dollars and Twenty-One Cents

谢谢!!!

 
                                                     

TA的精华主题

TA的得分主题

 楼主| 发表于 2007-11-24 14:01 | 显示全部楼层
QUOTE:
以下是引用Kyo_L在2007-11-22 11:38:00的发言:

首先,谢谢帮我之前的问题,但是现在是这样的,百位与十位要用and连起来,十位与个

位用"-"符号连接起来

                                                     

已改写试试看:

' SamSea
 
 
 '****************' Main Function *'****************
Function SpellNumber(ByVal MyNumber)
    Dim Dollars, Cents, Temp
    Dim DecimalPlace, Count
    ReDim Place(9) As String
    Application.Volatile True
    Place(2) = " Thousand "
    Place(3) = " Million "
    Place(4) = " Billion "
    Place(5) = " Trillion "     ' String representation of amount
    MyNumber = Format(MyNumber, "###0.00")
    MyNumber = Trim(Str(MyNumber))     ' Position of decimal place 0 if none
    DecimalPlace = InStr(MyNumber, ".")
    'Convert cents and set MyNumber to dollar amount
    If DecimalPlace > 0 Then
        Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
        End If
    Count = 1
    Do While MyNumber <> ""
       Temp = GetHundreds(Right(MyNumber, 3))
       If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
          If Len(MyNumber) > 3 Then
             MyNumber = Left(MyNumber, Len(MyNumber) - 3)
             Else
            MyNumber = ""
            End If
            Count = Count + 1
            Loop
    Select Case Dollars
        Case "":    Dollars = "No Dollars"
        Case "One": Dollars = "One Dollar"
        Case Else:  Dollars = Dollars & " Dollars"
    End Select
    Select Case Cents
        Case "":    Cents = " and No Cents"
        Case "One": Cents = " and One Cent"
        Case Else:  Cents = " and " & Cents & " Cents"
    End Select
    SpellNumber = Dollars & Cents
    SpellNumber = Replace(SpellNumber, "  ", " ")
    End Function
'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Function GetHundreds(ByVal MyNumber)
    Dim Result As String
    If Val(MyNumber) = 0 Then Exit Function
    MyNumber = Right("000" & MyNumber, 3)     'Convert the hundreds place
    If Mid(MyNumber, 1, 1) <> "0" Then
        Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred and "
        End If
    If Mid(MyNumber, 2, 2) = "00" Then
       Result = Replace(Result, "and ", "")
       End If
    'Convert the tens and ones place
    If Mid(MyNumber, 2, 1) <> "0" Then
        Result = Result & GetTens(Mid(MyNumber, 2))
        Else
        Result = Result & GetDigit(Mid(MyNumber, 3))
        End If
    If Mid(MyNumber, 2, 2) = "00" Then
       Result = Replace(Result, "and ", "")
       End If

    GetHundreds = Result
    End Function
'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************
Function GetTens(TensText)
    Dim Result As String
    Result = ""           'null out the temporary function value
    If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19
        Select Case Val(TensText)
            Case 10: Result = "Ten"
            Case 11: Result = "Eleven"
            Case 12: Result = "Twelve"
            Case 13: Result = "Thirteen"
            Case 14: Result = "Fourteen"
            Case 15: Result = "Fifteen"
            Case 16: Result = "Sixteen"
            Case 17: Result = "Seventeen"
            Case 18: Result = "Eighteen"
            Case 19: Result = "Nineteen"
            Case Else
            End Select
    Else                                 ' If value between 20-99
        Select Case Val(Left(TensText, 1))
            Case 2: Result = "Twenty-"
            Case 3: Result = "Thirty-"
            Case 4: Result = "Forty-"
            Case 5: Result = "Fifty-"
            Case 6: Result = "Sixty-"
            Case 7: Result = "Seventy-"
            Case 8: Result = "Eighty-"
            Case 9: Result = "Ninety-"
            Case Else
        End Select
        If Right(TensText, 1) = "0" Then
            Result = Replace(Result, "-", "")
        End If
        Result = Result & GetDigit _
            (Right(TensText, 1))  'Retrieve ones place
    End If
     
     
      GetTens = Result
      End Function
'*******************************************
' Converts a number from 1 to 9 into text. *
'*******************************************
Function GetDigit(Digit)
    Select Case Val(Digit)
        Case 1: GetDigit = "One"
        Case 2: GetDigit = "Two"
        Case 3: GetDigit = "Three"
        Case 4: GetDigit = "Four"
        Case 5: GetDigit = "Five"
        Case 6: GetDigit = "Six"
        Case 7: GetDigit = "Seven"
        Case 8: GetDigit = "Eight"
        Case 9: GetDigit = "Nine"
        Case Else: GetDigit = ""
    End Select
End Function

TA的精华主题

TA的得分主题

发表于 2007-12-3 15:16 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
能说下具体怎么应用吗?我刚下了,不知道怎么用,谢谢
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-11-25 02:54 , Processed in 0.035406 second(s), 6 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表