ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] ª÷ÃB¼Æ¦rÂà´«­^¤å¼gªk(VBA¦Û­q¨ç¼Æ)

[¤À¨É] ª÷ÃB¼Æ¦rÂà´«­^¤å¼gªk(VBA¦Û­q¨ç¼Æ)

ª÷ÃB¼Æ¦rÂà´«­^¤å¼gªk¡DVBA¦Û­q¨ç¼Æ  

Function USNumber(ByVal MyNumber, QType) As String
Dim i%, j%, TR, StrCT$, StrDR$, TT$, TU$, Num
If Val(MyNumber) <= 0 Then Exit Function
TR = Array("", "", " Thousand", " Million", " Billion", " Trillion")
'-¤p¼Æ³¡¥÷---------------------------
Num = Split(Format(MyNumber, "0.00"), ".")
TT = Get999(Num(1))
If TT <> "" Then StrCT = "Cents " & TT
'-¾ã¼Æ³¡¥÷---------------------------
Num = Split(Format(Num(0), "#,##0"), ",")
For i = UBound(Num) To 0 Step -1
    TT = Get999(Num(i))
    j = j + 1:  TU = Trim(TT & TR(j) & " " & TU)
Next i
StrDR = Trim(TU & " " & IIf(QType = 1, "Dollars", ""))
'---------------------------------
USNumber = StrDR & IIf(StrDR = "" Or StrCT = "", "", " And ") & StrCT & " Only"
End Function

'=====================================
Function Get999(TTNum) As String
Dim TN, TY, QQ%, GStr1$, GStr2$
TN = Split("-One-Two-Three-Four-Five-Six-Seven-Eight-Nine-Ten-Eleven-Twelve-Thirteen-Fourteen-Fifteen-Sixteen-Seventeen-Eighteen-Nineteen", "-")
TY = Split("--Twenty-Thirty-Forty-Fifty-Sixty-Seventy-Eighty-Ninety", "-")
'-¦Ê¦ì¼Æ---------------------------
GStr1 = TN(Int(TTNum / 100)) & " Hundred"
If GStr1 = " Hundred" Then GStr1 = ""
'-¤Q/­Ó¦ì¼Æ---------------------------
QQ = TTNum Mod 100
GStr2 = Replace(Trim(TY(Int(Right(QQ, 2) / 10)) & " " & TN(QQ Mod 10)), " ", "-")
If QQ < 20 Then GStr2 = TN(QQ)
Get999 = Trim(GStr1 & " " & GStr2)
End Function

'=================================
°Ñ¦ÒÀÉ:
20200321a01(ª÷ÃB¼Æ¦r­^¤å¼gªk).rar (11.23 KB)

µ{¦¡½X¤£Ãø, ­Y¦³¤£¦P®æ¦¡»Ý¨D, ½Ð¦Û¦æ­×§ï~~

        ÀR«ä¦Û¦b : ¡i°µ¤Hªº¶}©l¡j¨C¤@¤Ñ³£¬O¬G¤Hªº¶}©l¡A¨C¤@­Ó®É¨è³£¬O¦Û¤vªºÄµ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD