Excel Vba正数数字批量换成文字
时间:2022-08-29 05:16:12
今天拿到了一个比较棘手的难题,
把数字全部换成正数这两个字。我最早用了定位,但定位只能是数字而不能正数。我又写了定义对象大于0,后来发现居然字母都被换掉了,这显然不是我要的。后来问了一个朋友原来也还要写段代码进行是不是数字的判断。最后的结果是
Sub ee()
Dim rng As Range
For Each rng In Range("a1:d8") ‘foreach的用法
If IsNumeric(rng) And rng.Value > 0 Then ‘判断是不是数字类型,还有是不是>0
rng.Value = "正数" ‘把正数赋给所有的对象
End If
Next
End Sub
我后来又试了其他方法,都没成功。最后决定就用这段代码好了。
Excel Vba正数数字批量换成文字2
标签:批量,换成,数字,正数,Excel函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
在excel电子表格中怎么进行全部设置工作表的名称?
2023-03-09 14:44:26
![](https://img.aspxhome.com/file/2023/8/42248_0s.jpg)
word怎么显示标尺?
2023-06-29 23:06:02
![](https://img.aspxhome.com/file/2023/1/34421_0s.jpg)
word2013如何取消强制换行
2023-11-29 03:03:37
![](https://img.aspxhome.com/file/2023/3/17943_0s.jpg)
WORD2003邮件合并方法
2023-07-23 00:27:19
![](https://img.aspxhome.com/file/2023/0/21990_0s.gif)
excel表格加密方法
2023-10-04 03:30:02
word文档转成pdf时图章变成黑白色该怎么办?
2023-10-23 10:40:42
![](https://img.aspxhome.com/file/2023/8/30688_0s.jpg)
Excel中2007版表格查看最多能装载多少行列数的操作方法
2022-11-24 00:25:34
如何将excel转换成word的方法
2023-03-09 22:02:44
图片要在不同word文档中重复使用,如何快速调用?
2022-02-17 12:48:08
![](https://img.aspxhome.com/file/2023/0/35310_0s.png)
Win10系统弹出“Windows任务的主机进程已停止工作”窗口怎么解决?
2023-08-04 02:29:25
![](https://img.aspxhome.com/file/2023/1/46631_0s.png)
如何用Excel表格计算净现值VPN
2022-06-13 07:27:47
![](https://img.aspxhome.com/file/2023/9/a141849_0s.jpg)
excel表格设置区域保护的教程
2022-02-25 19:21:42
Excel2013怎么使用Power View插入地图?
2022-12-30 22:12:52
![](https://img.aspxhome.com/file/2023/4/40354_0s.jpg)
Excel2013自动保存功能怎么设置?
2023-11-20 23:50:59
![](https://img.aspxhome.com/file/2023/9/36059_0s.jpg)
Win10使用远程连接工具提示“您的凭证不工作”的解决办法
2023-11-15 16:39:01
![](https://img.aspxhome.com/file/2023/6/49216_0s.png)
Win10系统怎么拍摄屏幕截图?
2023-11-24 07:53:40
![](https://img.aspxhome.com/file/2023/1/50821_0s.jpg)
excel表格之如何输入0“零”
2023-11-23 07:06:16
![](https://img.aspxhome.com/file/2023/2/a143472_0s.jpg)
2013word页眉线设置方法
2022-12-08 05:03:55
你能同时锁定excel表头表尾吗?
2022-10-01 16:44:52
![](https://img.aspxhome.com/file/2023/3/a140883_0s.jpg)
excel 中快速调整为最合适的列宽和行高的方法
2023-11-24 14:39:55