Excel數(shù)字大寫(xiě)轉(zhuǎn)換_第1頁(yè)
Excel數(shù)字大寫(xiě)轉(zhuǎn)換_第2頁(yè)
Excel數(shù)字大寫(xiě)轉(zhuǎn)換_第3頁(yè)
Excel數(shù)字大寫(xiě)轉(zhuǎn)換_第4頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論