@@reancomputer101 Option Explicit 'Main Function Function SpellNumber(ByVal MyNumber) Dim Dollars, Cents, Temp Dim DecimalPlace, Count ReDim Place(9) As String Place(2) = "Ban; " Place(3) = "lan " Place(4) = "Ban;lan " Place(5) = "Esnekadi " MyNumber = Trim(Str(MyNumber)) DecimalPlace = InStr(MyNumber, ".") 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 = "erolKt;" Case Else Dollars = Dollars & "erolKt;" End Select Select Case Cents Case "" Cents = "" Case "One" Cents = "" Case Else Cents = "" & Cents & "" End Select SpellNumber = Dollars & Cents End Function 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)) & "ry" 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 GetHundreds = Result End Function 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 = "db;" Case 11: Result = "db;mYy" Case 12: Result = "db;BIr" Case 13: Result = "db;bI" Case 14: Result = "db;bYn" Case 15: Result = "db;R)aM" Case 16: Result = "db;R)aMmYy" Case 17: Result = "db;R)aMBIr" Case 18: Result = "db;R)aMbI" Case 19: Result = "db;R)aMbYn" Case Else End Select Else ' If value between 20-99... Select Case Val(Left(TensText, 1)) Case 2: Result = "émÖ" Case 3: Result = "samsib" Case 4: Result = "Essib" Case 5: Result = "hasib" Case 6: Result = "huksib" Case 7: Result = "citsib" Case 8: Result = "Eb:tsib" Case 9: Result = "ekAsib" Case Else End Select Result = Result & GetDigit _ (Right(TensText, 1)) ' Retrieve ones place. End If GetTens = Result End Function Function GetDigit(Digit) Select Case Val(Digit) Case 1: GetDigit = "mYy" Case 2: GetDigit = "BIr" Case 3: GetDigit = "bI" Case 4: GetDigit = "bYn" Case 5: GetDigit = "R)aM" Case 6: GetDigit = "R)aMmYy" Case 7: GetDigit = "R)aMBIr" Case 8: GetDigit = "R)aMbI" Case 9: GetDigit = "R)aMbYn" Case Else: GetDigit = "" End Select End Function
@ungsundeth56343 жыл бұрын
How can get code?
@reancomputer1013 жыл бұрын
ទាញយក Code និង Example Excel - www.rean.me/2018/06/how-to-convert-numeric-value-into-english-word.html