友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!
Excel word ppt office使用技巧大全(DOC格式)-第28部分
快捷操作: 按键盘上方向键 ← 或 → 可快速上下翻页 按键盘上的 Enter 键可回到本书目录页 按键盘上方向键 ↑ 可回到本页顶部! 如果本书没有阅读完,想下次继续接着阅读,可使用上方 "收藏到我的浏览器" 功能 和 "加入书签" 功能!
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 Select Case
Right('varThreeFigures'; 2) Case 11 varLettersTens = 〃eleven〃 varLettersUnits = 〃〃
varThreeLetters = varLettersTens Case 12 varLettersTens = 〃twelve〃 varLettersUnits = 〃〃
varThreeLetters = varLettersTens Case 13 varLettersTens = 〃thirteen〃 varLettersUnits = 〃〃
varThreeLetters = varLettersTens Case 14 varLettersTens = 〃fourteen〃 varLettersUnits = 〃〃
varThreeLetters = varLettersTens Case 15 varLettersTens = 〃fifteen〃
CXCVII
…………………………………………………………Page 198……………………………………………………………
Excel_word_ppt_使用技巧大全(完全版)
varLettersUnits = 〃〃 varThreeLetters = varLettersTens Case 16 varLettersTens = 〃sixteen〃
varLettersUnits = 〃〃 varThreeLetters = varLettersTens Case 17 varLettersTens =
〃seventeen〃 varLettersUnits = 〃〃 varThreeLetters = varLettersTens Case 18 varLettersTens
= 〃eighteen〃 varLettersUnits = 〃〃 varThreeLetters = varLettersTens Case 19 varLettersTens
= 〃nineteen〃 varLettersUnits = 〃〃 varThreeLetters = varLettersTens End Select If
Right(varThreeFigures; 1) = 0 Then varThreeLetters = varLettersTens End If End If If
Len('varThreeFigures') = 3 Then varThreeLetters = varLettersHundreds & 〃 〃 &
varLettersTens & 〃 〃 & varLettersUnits Select Case Right('varThreeFigures'; 2) Case 11
varLettersTens = 〃eleven〃 varLettersUnits = 〃〃 varThreeLetters = varLettersHundreds & 〃 〃
& varLettersTens Case 12 varLettersTens = 〃twelve〃 varLettersUnits = 〃〃 varThreeLetters =
varLettersHundreds & 〃 〃 & varLettersTens Case 13 varLettersTens = 〃thirteen〃
varLettersUnits = 〃〃 varThreeLetters = varLettersHundreds & 〃 〃 & varLettersTens Case 14
varLettersTens = 〃fourteen〃 varLettersUnits = 〃〃 varThreeLetters = varLettersHundreds & 〃 〃
& varLettersTens
CXCVIII
…………………………………………………………Page 199……………………………………………………………
Excel_word_ppt_使用技巧大全(完全版)
Case 15 varLettersTens = 〃fifteen〃 varLettersUnits = 〃〃 varThreeLetters =
varLettersHundreds & 〃 〃 & varLettersTens Case 16 varLettersTens = 〃sixteen〃
varLettersUnits = 〃〃 varThreeLetters = varLettersHundreds & 〃 〃 & varLettersTens Case 17
varLettersTens = 〃seventeen〃 varLettersUnits = 〃〃 varThreeLetters = varLettersHundreds &
〃 〃 & varLettersTens Case 18 varLettersTens = 〃eighteen〃 varLettersUnits = 〃〃
varThreeLetters = varLettersHundreds & 〃 〃 & varLettersTens Case 19 varLettersTens =
〃nineteen〃 varLettersUnits = 〃〃 varThreeLetters = varLettersHundreds & 〃 〃 &
varLettersTens End Select End If If varThreeFigures = 〃000〃 Then varThreeLetters = 〃〃 GoTo
jumpThousands End If If Right(varThreeFigures; 2) = 〃00〃 Then varThreeLetters =
varLettersHundreds GoTo jumpThousands End If If Left(varThreeFigures; 2) = 〃00〃 Then
varThreeLetters = 〃and 〃 & varLettersUnits GoTo jumpThousands End If If
Left(varThreeFigures; 1) = 〃0〃 Then varThreeLetters = 〃and 〃 & varLettersTens & 〃 〃 &
varLettersUnits End If If Left(varThreeFigures; 1) = 〃0〃 And Right(varThreeFigures; 1) = 〃0〃
Then
CXCIX
…………………………………………………………Page 200……………………………………………………………
Excel_word_ppt_使用技巧大全(完全版)
varThreeLetters = 〃and 〃 & varLettersTens GoTo jumpThousands End If '''
**************************************************************************
********************* ''Thousands jumpThousands: If varLenghtNumber 》 3 Then
varLettersUnits = varUnits(Right('varSixFigures'; 1)) varLettersTens
快捷操作: 按键盘上方向键 ← 或 → 可快速上下翻页 按键盘上的 Enter 键可回到本书目录页 按键盘上方向键 ↑ 可回到本页顶部!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!