关键词不能为空

当前您在: 主页 > 英语 >

Excel将数字翻译成英文的宏定义详解

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-14 03:55
tags:

-

2021年2月14日发(作者:乙二酸)


Excel


将阿拉伯数字翻译成英文,自动识别小数点,自动大


小写,按国际惯例翻译,十和个之间加“


-


”< /p>


,百和十之间加



and




首先要自定宏,



excel2003


里面工具栏可直接看到,



2007



2010


按以下方法打开:





Excle


选项





然后勾选“在功能区显示“开发工具选项卡“。此时在功能区 就能看


到,开发工具了。




然后点击


Visual Basic


进入




点击插入




选择插入模块,默认为模块一




在此对话框中输入自定义程序,


然后直接关闭,

如我们定义函数名为


SpellNumber


,在


Excle


中即开直接调用此函数,注意要在而


excel


设置中启用“宏”哦,小


伙伴们可以自己编程实现< /p>


excle


所有工作了,快去试试吧(如有疑问可联系:张小觉< /p>


qq367315133




附两段程序供参考:



不带单位的直译:



Function SpellNumber(ByVal MyNumber)






Dim Dollars, Cents, Temp






Dim DecimalPlace, Count






ReDim Place(9) As String






le True






Place(2) =






Place(3) =






Place(4) =






Place(5) =






' String representation of amount






MyNumber = Trim(Str(MyNumber))






' Position of decimal place 0 if none






DecimalPlace = InStr(MyNumber,






'Convert cents and set MyNumber to dollar amount






If DecimalPlace > 0 Then










Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) &










MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))










End If






Count = 1






Do While MyNumber <>









Temp = GetHundreds(Right(MyNumber, 3))









If Temp <>












If Len(MyNumber) > 3 Then















MyNumber = Left(MyNumber, Len(MyNumber) - 3)















Else














MyNumber =














End If


Count = Count + 1














Loop






Select Case Dollars










Case














Dollars =










Case














Dollars =










Case Else














Dollars = Dollars






End Select






Select Case Cents










Case














Cents =










Case














Cents =










Case Else














Cents =

-


-


-


-


-


-


-


-



本文更新与2021-02-14 03:55,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/654569.html

Excel将数字翻译成英文的宏定义详解的相关文章