友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!阅读过程发现任何错误请告诉我们,谢谢!! 报告错误
一世书城 返回本书目录 我的书架 我的书签 TXT全本下载 进入书吧 加入书签

Excel word ppt office使用技巧大全(DOC格式)-第38章

按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!




Dim Temp   

Dim Dollars; Cents   

Dim DecimalPlace; Count   

ReDim Place(9) As String   

Place(2) = 〃 Thousand 〃   

Place(3) = 〃 Million 〃   

Place(4) = 〃 Billion 〃   

Place(5) = 〃 Trillion 〃   

' Convert MyNumber to a string; trimming extra spaces。   

MyNumber = Trim(Str(MyNumber))   

' Find decimal place。   

DecimalPlace = InStr(MyNumber; 〃。〃)   

' If we find decimal place。。。   

If DecimalPlace 》 0 Then   

' Convert cents   

Temp = Left(Mid(MyNumber; DecimalPlace + 1) & 〃00〃; 2)   

Cents = ConvertTens(Temp)   

' Strip off cents from remainder to convert。   

MyNumber = Trim(Left(MyNumber; DecimalPlace 1))   

End If   

Count = 1   

Do While MyNumber  〃〃   

' Convert last 3 digits of MyNumber to English dollars。   

Temp = ConvertHundreds(Right(MyNumber; 3))   

If Temp  〃〃 Then Dollars = Temp & Place(Count) & Dollars   

If Len(MyNumber) 》 3 Then   

' Remove last 3 converted digits from MyNumber。   

MyNumber = Left(MyNumber; Len(MyNumber) 3)   

Else   

MyNumber = 〃〃   

End If   

Count = Count + 1   

Loop   



                                          CXCII  


…………………………………………………………Page 193……………………………………………………………

                               Excel_word_ppt_使用技巧大全(完全版)  



' Clean up dollars。   

Select Case Dollars   

Case 〃〃   

Dollars = 〃No Dollars〃   

Case 〃One〃   

Dollars = 〃One Dollar〃   

Case Else   

Dollars = Dollars & 〃 Dollars〃   

End Select   

' Clean up cents。   

Select Case Cents   

Case 〃〃   

Cents = 〃 And No Cents〃   

Case 〃One〃   

Cents = 〃 And One Cent〃   

Case Else   

Cents = 〃 And 〃 & Cents & 〃 Cents〃   

End Select   

ConvertCurrencyToEnglish = Dollars & Cents   

End Function   

Private Function ConvertHundreds (ByVal MyNumber)   

Dim Result As String   

' Exit if there is nothing to convert。   

If Val(MyNumber) = 0 Then Exit Function   

' Append leading zeros to number。   

MyNumber = Right(〃000〃 & MyNumber; 3)   

' Do we have a hundreds place digit to convert?   

If Left(MyNumber; 1)  〃0〃 Then   

Result = ConvertDigit(Left(MyNumber; 1)) & 〃 Hundred 〃   

End If   

' Do we have a tens place digit to convert?   

If Mid(MyNumber; 2; 1)  〃0〃 Then   

Result = Result & ConvertTens(Mid(MyNumber; 2))   

Else   



                                          CXCIII  


…………………………………………………………Page 194……………………………………………………………

                               Excel_word_ppt_使用技巧大全(完全版)  



' If not; then convert the ones place digit。   

Result = Result & ConvertDigit(Mid(MyNumber; 3))   

End If   

ConvertHundreds = Trim(Result)   

End Function   

Private Function ConvertTens (ByVal MyTens)   

Dim Result As String   

' Is value between 10 and 19?   

If Val(Left(MyTens; 1)) = 1 Then   

Select Case Val(MyTens)   

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   

' 。。 otherwise it's between 20 and 99。   

Select Case Val(Left(MyTens; 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   

' Convert ones place digit。   

Result = Result & ConvertDigit(Right(MyTens; 1))   

End If   



                                         CXCIV  


…………………………………………………………Page 195……………………………………………………………

                                Excel_word_ppt_使用技巧大全(完全版)  



ConvertTens = Result   

End Function   

Private Function ConvertDigit (ByVal MyDigit)   

Select Case Val(MyDigit)   

Case 1: ConvertDigit = 〃One〃   

Case 2: ConvertDigit = 〃Two〃   

Case 3: ConvertDigit = 〃Three〃   

Case 4: ConvertDigit = 〃Four〃   

Case 5: ConvertDigit = 〃Five〃   

Case 6: ConvertDigit = 〃Six〃   

Case 7: ConvertDigit = 〃Seven〃   

Case 8: ConvertDigit = 〃Eight〃   

Case 9: ConvertDigit = 〃Nine〃   

Case Else: ConvertDigit = 〃〃   

End Select   

End Function   

===   

 《23》转英文(另一篇) EXCEL中如何将数字转换为英文在EXCEL中通过格式和TEXT函数可以 

将数字表示为中文大写格式,现在我需要将数字转示为英文文字格式,如将220转换为two  

hundred and twenty,请问有什么办法实现。  

===   

Function   fctNumbersLetters(NumberFigures)   Dim   varLenghtNumber   As   Integer   Dim  

varThreeLetters As String Dim varThreeFigures As String Dim varSixLetters As String Dim  

varSixFigures  As  String  Dim  varNineLetters  As  String  Dim  varNineFigures  As  String  Dim  

varTwelveLetters As String Dim varTwelveFigures As String Dim varLettersUnits As String  

Dim varLettersTens As String    



                                           CXCV  


…………………………………………………………Page 196……………………………………………………………

                                     Excel_word_ppt_使用技巧大全(完全版)  



Dim varLettersHundreds As String Dim varUnits(9) As String Dim varTens(9) As String Dim  

varHundreds(9)      As   String   Dim    varPremiereLettre     As    String   NumberFigures      =  

Int(Val(NumberFigures))   varLenghtNumber   =   Len(NumberFigures)   varThreeFigures   =  

Right(NumberFigures;  3)  If  varLenghtNumber  》  3  And  varLenghtNumber  《  7  Then  

varSixFigures   =   Right(Left(NumberFigures;   Len(NumberFigures)     3);   3)   End   If   If  

varLenghtNumber       》    6   And     varLenghtNumber       《    10    Then    varSixFigures    =  

Right(Left(NumberFigures;        Len(NumberFigures)           3);    3)    varNineFigures      =  

Right(Left(NumberFigures; Len(NumberFigures) 6); 3) End If If varLenghtNumber 》 9 And  

varLenghtNumber         《    13     Then      varSixFigures     =     Right(Left(NumberFigures;  

Len(NumberFigures)           3);    3)     varNineFigures      =    Right(Left(NumberFigures;  

Len(NumberFigures)          6);    3)    varTwelveFigures      =    Right(Left(NumberFigures;  

Len(NumberFigures)                         9);          3)           End            If           '  

**********************************************************************  

varUnits(0) = 〃0〃 varUnits(1) = 〃one〃 varUnits(2) = 〃two〃 varUnits(3) = 〃three〃 varUnits(4)  

= 〃four〃 varUnits(5) = 〃five〃 varUnits(6) = 〃six〃 varUnits(7) = 〃seven〃 varUnits(8) = 〃eight〃  

varUnits(9) = 〃nine〃 varTens(0) = 〃0〃 varTens(1) = 〃ten〃 varTens(2) = 〃twenty〃 varTens(3)  

=  〃thirty〃  varTens(4)  =  〃forty〃  varTens(5)  =  〃fifty〃  varTens(6)  =  〃sixty〃  varTens(7)  =  

〃seventy〃 varTens(8) = 〃eighty〃 varTens(9) = 〃ninety〃    



                                                  CXCVI  


…………………………………………………………Page 197……………………………………………………………

                                      Excel_word_ppt_使用技巧大全(完全版)  



varHundreds(0) = 〃0〃 varHundreds(1) = 〃one hundred〃 varHundreds(2) = 〃two hundred〃  

varHundreds(3) = 〃three hundred〃 varHundreds(4) = 〃four hundred〃 varHundreds(5) = 〃five  

hundred〃     varHundreds(6)      =    〃six   hundred〃     varHundreds(7)      =    〃seven    hundred〃  

varHundreds(8)       =     〃eight     hundred〃      varHundreds(9)       =     〃nine    hundred〃      '  

**********************************************************************                                 '  

Hundreds;      Tens;    Units    varLettersUnits      =    varUnits(Right('varThreeFigures';        1))  

varLettersTens  =  varTens(Left(Right('varThreeFigures';  2);  1))  varLettersHundreds  =  

varHundreds(Left(Right('varThreeFigures';  3);  1))  If  Len('varThreeFigures')  =  1  Then  

varThreeLetters     =    varLettersUnits    End    If   If  Len('varThreeFigures')       =   2   Then  

varThreeLetters      =     varLettersTens      &    〃    〃    &    varLettersUnits 
返回目录 上一页 下一页 回到顶部 0 1
未阅读完?加入书签已便下次继续阅读!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!