LOADING STUFF...

Excel数字格式问题:如何将数字转换为大写

技术教程5小时前发布 北陌
15 0 0

Excel数字格式问题:如何将数字转换为大写,绿夏技术导航根据你的问题回答如下:

Excel数字格式问题:如何将数字转换为大写

在Excel中将数字转换为大写可以通过以下两种方式实现:

1. 使用VB脚本自定义函数

这是一种比较麻烦的方法,需要一些编程基础,但是可以实现比较精确的转换。具体步骤如下:

①打开Excel,按快捷键Alt F11进入Visual Basic 编辑器。

②在新的模块中添加自定义函数的代码如下:

Function ChineseNum(MyNumber)

创建拼音数字对应表

PyChars = Array(“”, “壹”, “贰”, “叁”, “肆”, “伍”, “陆”, “柒”, “捌”, “玖”)

PyNameChars = Split(“仟,佰,拾,”, “,”) 段位级配数组

PyUnitChars = Split(“元,万,亿,”, “,”) 节权单位分隔数组

Dim RMBstr, integerStr, decimalStr

Dim isNegative

isNegative = “”;

RMBstr = “”

将数字进行三位拆分

integerStr = Format(Int(myNumber), “000000000”)

decimalStr = Format((myNumber – Int(myNumber)), “.00”)

if Left(integerStr, 1) = “-” then

isNegative = “负”

integerStr = Right(integerStr, Len(integerStr) – 1)

End if

for i = 1 to 4

if Mid(integerStr, i * 3 – 2, 3) = “000” Then

Else

RMBstr = RMBstr

© 版权声明

相关文章

暂无评论

暂无评论...