×
热门分类
微信扫码登陆

QQ登录

只需一步,快速开始

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即加入SketchUp吧! 微信扫码登陆

x
Excel自动转换数字大小写具体的操作步骤如下: (对于做预算报价很有用处哦)

1. 启动excel。按“alt+f11”快捷键打开“visual basic编辑器”。

2. 在“visual basic编辑器”中,单击“插入”菜单栏中的“模块”命令,插入一个模块。双击左侧“工程”窗口中的“模块1”选项,在窗口右边展开“模块1(代码)”编辑窗口,然后输入如下代码:

function dx(q)

dim cur as long,yuan as long

dim jiao as integer,fen as integer

dim cnyuan as string, cnjiao as string, cnfen as string

if q = "" then

dx = 0

exit function

end if

cur = round(q * 100)

yuan = int(cur / 100)

jiao = int(cur / 10) - yuan * 10

fen = cur - yuan * 100 - jiao * 10

cnyuan = application.worksheetfunction.text(yuan, "[dbnum2]")

cnjiao = application.worksheetfunction.text(jiao, "[dbnum2]")

cnfen = application.worksheetfunction.text(fen, "[dbnum2]")

dx = cnyuan & "元" & "整"

d1 = cnyuan & "元"

if fen <> 0 and jiao <> 0 then

dx = d1 & cnjiao & "角" & cnfen & "分"

if yuan = 0 then

dx = cnjiao & "角" & cnfen & "分"

end if

end if

if fen = 0 and jiao <> 0 then

dx = d1 & cnjiao & "角" & "整"

if yuan = 0 then

dx = cnjiao & "角" & "整"

end if

end if

if fen <> 0 and jiao = 0 then

dx = d1 & cnjiao & cnfen & "分"

if yuan = 0 then

dx = cnfen & "分"

end if

end if

end function

输 入完成后,关闭“visual basic编辑器”返回工作表。现在,我们可测试一下这个函数。首先,在a1单元格中输入一个小写数字的金额,例如123456.78,然后,在a2单元 格中输入公式:=dx(a1),确认后即可将a1所表示的小写数字金额转换为大写的数字金额,并在a2单元格中显示出来。怎么样,方便吧?

精彩评论

文明上网理性发言、请文明用语

成为第一个回答人

高级模式
您需要登录后才可以回帖 登录 | 立即加入SketchUp吧! 微信扫码登陆

本版积分规则

hadron

论坛元老

  • 主题

    135

  • 吧币

    140164

  • 红宝石

    2698

关闭

站长推荐上一条 /2 下一条

积分兑换活动
发布主题 快速回复 返回列表 客服中心 搜索 官方QQ群
关于我们/小黑屋/手机app/国土人/SketchUp吧 /京ICP备16008035号/