下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、1.阿拉伯數(shù)字轉(zhuǎn)換中文大寫。=IF(A7-INT(A7)=0,TEXT(A7,"DBNUM2")&"元整",IF(INT(A7*10)-A7*10=0,TEXT(INT(A7),"DBNUM2")&"元"&TEXT(INT(A7*10)-INT(A7)*10),"DBNUM2")&"角整",TEXT(INT(A7),"DBNUM2")&"元"&IF(INT(A7*10)-INT(A7)*1
2、0=0,"零",TEXT(INT(A7*10)-INT(A7)*10,"DBNUM2")&"角")&TEXT(RIGHT(A7,1),"DBNUM2")&"分")該函數(shù)中只需將A7換成你要轉(zhuǎn)換的數(shù)值所在單元格即可。2.阿拉伯數(shù)字轉(zhuǎn)換英文大寫(編寫SpellNumber實例函數(shù))2.1 啟動 Microsoft Excel。 2.2 按 Alt+F11 啟動 Visual Basic 編輯器。 2.3 在“插入”菜單上,單擊“模塊”。 2.4 在模塊表中鍵入下面的代碼。Fu
3、nction ConvertCurrencyToEnglish(ByVal MyNumber) Dim Temp Dim Dollars, Cents Dim DecimalPlace, Count
4、60; ReDim Place(9) As String Place(2) = " Thousand " Place(3) = " Million " Place(4) = " Billion &quo
5、t; Place(5) = " Trillion " ' Convert MyNumber to a string, trimming extra spaces. MyNumber = Trim(Str(Round(MyNumber, 2)
6、0; ' Find decimal place. DecimalPlace = InStr(MyNumber, ".") ' If we find decimal place.
7、160; If DecimalPlace > 0 Then ' Convert cents Temp = Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2)
8、; Cents = ConvertTens(Temp) ' Strip off cents from remainder to convert. MyNumber = Trim(Left(MyNumber,
9、DecimalPlace - 1) End If Count = 1 Do While MyNumber <> ""
10、0; ' Convert last 3 digits of MyNumber to English dollars. Temp = ConvertHundreds(Right(MyNumber, 3) If Temp <> "" Then Dollars =
11、Temp & Place(Count) & Dollars If Len(MyNumber) > 3 Then ' Remove last 3 converted digits from MyNumber.
12、160; MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "
13、" End If Count = Count + 1 Loop ' Clean
14、 up dollars. Select Case Dollars Case "" Dollars = "No Dollars"&
15、#160; Case "One" Dollars = "One Dollar" Case Else
16、60; Dollars = Dollars & " Dollars" End Select ' Clean up cents.
17、60; Select Case Cents Case "" Cents = " Only" &
18、#160; Case "One" Cents = " And One Cent" Case Else
19、160; Cents = " And " & Cents & " Cents" End Select ConvertCurrencyToEnglish = Dollars & Cents &
20、#160; End Function Private Function ConvertHundreds(ByVal MyNumber) Dim Result As String ' Exit if there is nothing to convert. &
21、#160; If Val(MyNumber) = 0 Then Exit Function ' Append leading zeros to number. MyNumber = Right("000" & MyNumber, 3)
22、60; ' Do we have a hundreds place digit to convert? If Left(MyNumber, 1) <> "0" Then If Right("000" & MyNumber, 2) <> 0 Th
23、en Result = ConvertDigit(Left(MyNumber, 1) & " Hundred and " Else Resu
24、lt = ConvertDigit(Left(MyNumber, 1) & " Hundred " End If End If ' Do we have a tens place digit to convert?&
25、#160; If Mid(MyNumber, 2, 1) <> "0" Then Result = Result & ConvertTens(Mid(MyNumber, 2) Else
26、160; ' If not, then convert the ones place digit. Result = Result & ConvertDigit(Mid(MyNumber, 3) End If
27、160; ConvertHundreds = Trim(Result) End Function Private Function ConvertTens(ByVal MyTens) Dim Result As String
28、160; ' Is value between 10 and 19? If Val(Left(MyTens, 1) = 1 Then Select Case Val(MyTens)
29、160; Case 10: Result = "Ten" Case 11: Result = "Eleven" Case 12:
30、 Result = "Twelve" Case 13: Result = "Thirteen" Case 14: Result = "Fourteen"
31、160; Case 15: Result = "Fifteen" Case 16: Result = "Sixteen"
32、0; Case 17: Result = "Seventeen" Case 18: Result = "Eighteen" Case 19:
33、 Result = "Nineteen" Case Else End Select Else
34、0; ' . otherwise it's between 20 and 99. Select Case Val(Left(MyTens, 1) Case 2: Result
35、= "Twenty" Case 3: Result = "Thirty" Case 4: Result = "Forty"
36、; Case 5: Result = "Fifty" Case 6: Result = "Sixty" &
37、#160; Case 7: Result = "Seventy" Case 8: Result = "Eighty" Case 9: Result = "Ninety"
38、 Case Else End Select ' Convert ones place digit. &
39、#160; If Val(Right(MyTens, 1) = 0 Then Result = Result & " " & ConvertDigit(Right(MyTens, 1)
40、0; Else Result = Result & "-" & ConvertDigit(Right(MyTens, 1) End If End If ConvertTens = Result End Function Private Function ConvertDigit(ByVal MyDigit) Select Case Val(MyDigit)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 中國酒類電子商務行業(yè)市場深度分析及發(fā)展前景預測報告
- 2025-2031年中國新型泛娛樂視頻行業(yè)市場全景分析及投資戰(zhàn)略規(guī)劃報告
- 2024-2025年中國防靜電包裝材料行業(yè)市場調(diào)查研究及投資戰(zhàn)略咨詢報告
- 2025年秋衣褲項目可行性研究報告
- 中國風電海纜行業(yè)市場深度分析及投資潛力預測報告
- 2025年火鍋底料項目申請報告模范
- 水務管理系統(tǒng)開發(fā)合同
- 2025年直流電弧爐項目提案報告模板
- 中國床墊機械行業(yè)市場深度分析及投資戰(zhàn)略規(guī)劃報告
- 2024年大數(shù)據(jù)分析服務采購合同
- 人教版五年級上冊數(shù)學簡便計算大全500題及答案
- 創(chuàng)新創(chuàng)業(yè)教育課程體系
- 包裝品質(zhì)彩盒外箱知識課件
- 神經(jīng)外科課件:神經(jīng)外科急重癥
- 頸復康腰痛寧產(chǎn)品知識課件
- 2024年低壓電工證理論考試題庫及答案
- 微電網(wǎng)市場調(diào)查研究報告
- 《民航服務溝通技巧》教案第14課民航服務人員上行溝通的技巧
- MT/T 538-1996煤鉆桿
- 小學六年級語文閱讀理解100篇(及答案)
- CB/T 467-1995法蘭青銅閘閥
評論
0/150
提交評論