下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(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)換中文大寫(xiě)。=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ù)值所在單元格即可。(編寫(xiě)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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝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ù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 電梯課程設(shè)計(jì)范文
- 舞蹈機(jī)構(gòu)結(jié)業(yè)課程設(shè)計(jì)
- 統(tǒng)編版七年級(jí)語(yǔ)文上冊(cè)《5 秋天的懷念》-教學(xué)設(shè)計(jì)
- 游戲行業(yè)銷(xiāo)售人員工作總結(jié)
- 自閉癥科護(hù)士工作總結(jié)
- 2024年研學(xué)旅行指導(dǎo)師考試題庫(kù)(含答案)
- 2023-2024學(xué)年遼寧省大連二十四中高一(下)期中語(yǔ)文試卷
- 美發(fā)沙龍營(yíng)業(yè)員技巧總結(jié)
- 2024年認(rèn)識(shí)星期教案
- 農(nóng)村安裝雨棚材料合同(2篇)
- 《XL集團(tuán)破產(chǎn)重整方案設(shè)計(jì)》
- 智慧金融合同施工承諾書(shū)
- 術(shù)后甲狀旁腺功能減退癥管理專家共識(shí)
- 漢字文化解密學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
- 國(guó)家開(kāi)放大學(xué)電大本科《工程經(jīng)濟(jì)與管理》2023-2024期末試題及答案(試卷號(hào):1141)
- TBT3134-2023機(jī)車(chē)車(chē)輛驅(qū)動(dòng)齒輪箱 技術(shù)要求
- 河北省石家莊市橋西區(qū)2022-2023學(xué)年七年級(jí)上學(xué)期期末地理試卷
- 水利工程安全生產(chǎn)組織機(jī)構(gòu)
- 實(shí)施農(nóng)村客運(yùn)公交化改造推進(jìn)城鄉(xiāng)客運(yùn)一體化發(fā)展
- 口腔修復(fù)學(xué)專業(yè)英語(yǔ)詞匯整理
- 【圖文】化學(xué)纖維質(zhì)量檢驗(yàn)標(biāo)準(zhǔn)
評(píng)論
0/150
提交評(píng)論