1.word里面怎么把数字设为千分位
手动输入个英文逗号就行,如有你非要高难度的,我转一个文章给你,你看看吧
采用了vba编写了一个小程序来实现这一功能,以方便有这方向烦恼的读者,程序如下:
sub 改变数字格式为千分位格式 ()
dim strwithth as string '用于保存处理后的数字
dim inti as integer
'循环给定的数字
dim intlen as integer '求数字长度
dim intcount as integer '保存改变个数
with selection
.homekey unit:=wdstory '回到文章开头
.find.clearformatting
do
.find.text = "^#^#^#^#" '查找4位数字
'如果没有找到,退出
if .find.execute = false then
msgbox "长春崔宇的程序:千分位设置完毕!共改变 " & intcount & "个数字。", vbinformation
exit sub
end if
intcount = intcount + 1 '计数器增加
.moveleft '移到整个数字的左边
.moveright unit:=wdword, count:=1, extend:=wdextend '选择整个数字
intlen = len(.text)
strwithth = "" '清空
for inti = intlen to 1 step -3
if inti > 3 then
strwithth = "," & mid(.text, inti - 2, 3) & strwithth
else
'对于长度为3的倍数的数字特别处理
strwithth = left(.text, iif(intlen mod 3 = 0, 3, intlen mod 3)) & strwithth
end if
next
.text = strwithth
.moveright '右移一个来取消选择
loop
end with
end sub
将上面的代码,保存在normal模板中,需要运行时,按alt+f8选择该宏运行就可以了,当然也可为这个宏分配一个按钮。
程序的实现方法:程序是以word的查找为基础,找到四位以上的数字,然后选择这个数字,将其变为千分位格式后写回,循环到查找结束。当然代码中并没有对数字进行细致的分析,所以对“2002年”这样不应加千分位的数字也会处理。代码在office9,office10,office11,office12上运行通用。
2.word2007数字千分位怎么设,是word不是excel,是2?
手动输入个英文逗号就行,如有你非要高难度的,我转一个文章给你,你看看吧采用了VBA编写了一个小程序来实现这一功能,以方便有这方向烦恼的读者,程序如下:Sub 改变数字格式为千分位格式 () Dim strWithTh As String '用于保存处理后的数字 Dim intI As Integer '循环给定的数字 Dim intLen As Integer '求数字长度 Dim intCount As Integer '保存改变个数 With Selection 。
HomeKey Unit:=wdStory '回到文章开头 。Find。
ClearFormatting Do 。Find。
Text = "^#^#^#^#" '查找4位数字 '如果没有找到,退出 If 。Find。
Execute = False Then MsgBox "长春崔宇的程序:千分位设置完毕!共改变 " & intCount & "个数字。 ", vbInformation Exit Sub End If intCount = intCount 1 '计数器增加 。
MoveLeft '移到整个数字的左边 。MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend '选择整个数字 intLen = Len(。
Text) strWithTh = "" '清空 For intI = intLen To 1 Step -3 If intI > 3 Then strWithTh = "," & Mid(。 Text, intI - 2, 3) & strWithTh Else '对于长度为3的倍数的数字特别处理 strWithTh = Left(。
Text, IIf(intLen Mod 3 = 0, 3, intLen Mod 3)) & strWithTh End If Next 。 Text = strWithTh 。
MoveRight '右移一个来取消选择 Loop End WithEnd Sub将上面的代码,保存在NORMAL模板中,需要运行时,按ALT F8选择该宏运行就可以了,当然也可为这个宏分配一个按钮。 程序的实现方法:程序是以WORD的查找为基础,找到四位以上的数字,然后选择这个数字,将其变为千分位格式后写回,循环到查找结束。
当然代码中并没有对数字进行细致的分析,所以对“2002年”这样不应加千分位的数字也会处理。 代码在OFFICE9,OFFICE10,OFFICE11,OFFICE12上运行通用。
3.word如何把数字设为千分位
word中,没有自动实现数字转换为千分位格式的方法,只能通过手工编写宏命令的方法来实现。
具体步骤如下:
1、打开word;'
2、按alt+F11打VBA编辑器,点击插入->;模块;
3、在模块窗口输入以下宏指令:
Sub FormatNumbers()
Selection.TypeText Text:=Format(Selection, "#,##0.00")
End Sub
4、保存退出VBA编辑器;
5、点击office按钮->word选项;
6、打开自定义对话框,选择宏,点击添加,确定;
7、选择需要设置会计格式的数字,点击快捷栏中的宏命令;
8、完成。
转载请注明出处116知识网 » 在word中如何将数字千分位(word里面怎么把数字设为千分位)