下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、1.阿拉伯?dāng)?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ù)值所在單元格即可。(編寫SpellNumber實(shí)例函數(shù))2.1 啟動(dòng) Microsoft Excel。 2.2 按 Alt+F11 啟動(dòng) Visual Basic 編輯器。 2.3 在“插入”菜單上,單擊“模塊”。 2.4 在模塊表中鍵入下面的代碼。Function Conver
3、tCurrencyToEnglish(ByVal MyNumber) Dim Temp Dim Dollars, Cents Dim DecimalPlace, Count
4、0; ReDim Place(9) As String Place(2) = " Thousand " Place(3) = " Million " Place(4) = " Billion "
5、; Place(5) = " Trillion " ' Convert MyNumber to a string, trimming extra spaces. MyNumber = Trim(Str(Round(MyNumber, 2)
6、; ' Find decimal place. DecimalPlace = InStr(MyNumber, ".") ' If we find decimal place.
7、60; 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, DecimalPlace
9、- 1) End If Count = 1 Do While MyNumber <> "" '
10、; Convert last 3 digits of MyNumber to English dollars. Temp = ConvertHundreds(Right(MyNumber, 3) If Temp <> "" Then Dollars = Temp & Pl
11、ace(Count) & Dollars If Len(MyNumber) > 3 Then ' Remove last 3 converted digits from MyNumber.
12、60; MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" &
13、#160; End If Count = Count + 1 Loop ' Clean up dollars.&
14、#160; Select Case Dollars Case "" Dollars = "No Dollars"
15、160; Case "One" Dollars = "One Dollar" Case Else
16、0; Dollars = Dollars & " Dollars" End Select ' Clean up cents.
17、0; Select Case Cents Case "" Cents = " Only"
18、160; Case "One" Cents = " And One Cent" Case Else
19、60; Cents = " And " & Cents & " Cents" End Select ConvertCurrencyToEnglish = Dollars & Cents End Fun
20、ction 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、0; ' Do we have a hundreds place digit to convert? If Left(MyNumber, 1) <> "0" Then If Right("000" & MyNumber, 2) <> 0 Then
23、; Result = ConvertDigit(Left(MyNumber, 1) & " Hundred and " Else Result = ConvertD
24、igit(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、60; ' If not, then convert the ones place digit. Result = Result & ConvertDigit(Mid(MyNumber, 3) End If
27、60; ConvertHundreds = Trim(Result) End Function Private Function ConvertTens(ByVal MyTens) Dim Result As String
28、60; ' Is value between 10 and 19? If Val(Left(MyTens, 1) = 1 Then Select Case Val(MyTens)
29、60; Case 10: Result = "Ten" Case 11: Result = "Eleven" Case 12: Result = &qu
30、ot;Twelve" Case 13: Result = "Thirteen" Case 14: Result = "Fourteen"
31、60; Case 15: Result = "Fifteen" Case 16: Result = "Sixteen"
32、; Case 17: Result = "Seventeen" Case 18: Result = "Eighteen" Case 19: Result = &qu
33、ot;Nineteen" Case Else End Select Else
34、; ' . otherwise it's between 20 and 99. Select Case Val(Left(MyTens, 1) Case 2: Result = "Twent
35、y" Case 3: Result = "Thirty" Case 4: Result = "Forty"
36、 Case 5: Result = "Fifty" Case 6: Result = "Sixty" C
37、ase 7: Result = "Seventy" Case 8: Result = "Eighty" Case 9: Result = "Ninety" &
38、#160; Case Else End Select ' Convert ones place digit.
39、160; If Val(Right(MyTens, 1) = 0 Then Result = Result & " " & ConvertDigit(Right(MyTens, 1) Else
40、 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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 四川省綿陽市北川羌族自治縣2024-2025學(xué)年九年級(jí)上學(xué)期1月期末考試歷史試卷(含答案)
- 湖南省永州市道縣2024-2025學(xué)年八年級(jí)上學(xué)期期末考試物理試卷(含答案)
- 廣東省茂名市高州市2024-2025學(xué)年九年級(jí)上學(xué)期期末質(zhì)量監(jiān)測(cè)道德與法治試題(含答案)
- 2025年度倉(cāng)儲(chǔ)租賃及倉(cāng)儲(chǔ)信息化系統(tǒng)建設(shè)協(xié)議3篇
- 2024前臺(tái)工作計(jì)劃范本(30篇)
- 音頻通信知識(shí)培訓(xùn)課件
- 2025年度年度財(cái)務(wù)審計(jì)與合規(guī)審查合同3篇
- 2025年度廠房改造裝修與節(jié)能照明系統(tǒng)合同3篇
- 2024藥房員工特殊工種勞動(dòng)保護(hù)及職業(yè)健康合同3篇
- 2024物業(yè)管理承包經(jīng)營(yíng)合同書
- 基金項(xiàng)目經(jīng)理招聘筆試題與參考答案(某大型集團(tuán)公司)2025年
- 2023-2024學(xué)年浙江省麗水市蓮都區(qū)教科版六年級(jí)上冊(cè)期末考試科學(xué)試卷
- 學(xué)校2024-2025學(xué)年教研工作計(jì)劃
- 北京市矢量地圖-可改顏色
- 2024北京初三(上)期末語文匯編:議論文閱讀
- 安徽省蕪湖市2023-2024學(xué)年高一上學(xué)期期末考試 歷史 含解析
- 鋰電池應(yīng)急處理培訓(xùn)
- 煙草執(zhí)法課件教學(xué)課件
- 數(shù)字化交付施工方案
- 2024年領(lǐng)導(dǎo)干部和公務(wù)員法律法規(guī)應(yīng)知應(yīng)會(huì)知識(shí)考試題庫(kù)
- 綿陽小升初數(shù)學(xué)試題(綿中英才學(xué)校)
評(píng)論
0/150
提交評(píng)論