vba - 运行时错误 - VBA 溢出 - 零除以零
问题描述
我在编写用于计算 % 费用的代码时遇到了一些问题。每当代码到达 H 和 M 列中的值为零的行时,我都会收到运行时错误 6。
下面是我的数据示例
H 列 | M栏 | N 列 |
---|---|---|
5230170.94 | 3921.5 | 0.90% |
20951143.9 | 12225.89 | 0.70% |
0 | 0 |
下面是我的代码
Dim Main As Worksheet
Dim AUMLR, x As Long
Set Main = ActiveSheet
AUMLR = Main.Range("A" & Rows.Count).End(xlUp).Row
For x = 2 To AUMLR
Main.Range("N" & x).Value = Main.Range("M" & x).Value / Main.Range("H" & x).Value * 12
Next x
End Sub
解决方案
推荐阅读
- ruby-on-rails - 如何在 ruby on rails 中设置书签链接
- javascript - 将json数据从JS每个循环传递到JS函数时输入错误意外结束
- r - 根据字符串值提取数据
- android - 改造请求正文在 @Body 参数中添加双引号
- javascript - 光线投射墙没有画得一样宽
- javascript - 在 mongo db 中将日期格式更改为另一种格式
- javascript - (节点:71307)[DEP0079] 弃用警告
- postgresql - Postgres 中的长度和精度问题
- asp.net-mvc - ASP.NET MVC 5: UserManager.CreateAsync(user, model.Password); 没有将用户添加到数据库
- php - 无法更改上传文件的文件夹位置