作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试在 Excel VBA 中进行计算,但收到错误
Application-Defined or Object-Defined Error
这是我尝试执行的代码。错误发生在 .FormulaR1C1 = ...
行,但我不知道为什么。
Function CalcNumDays()
Dim d1 As Date, d2 As Date, NoofDays As Variant
d1 = "01/01/2017"
d2 = "03/01/2017"
NoofDays = Application.WorksheetFunction.NetworkDays(d1, d2)
With Sheets("ALL")
With .Range("K2:K" & .Cells(.Rows.Count, "A").End(xlUp).Row)
.FormulaR1C1 = "=IFERROR(SUM((RC[-8]+RC[-7]/RC[-4])*NoofDays,0)"
.Value = .Value
End With
End With
End Function
最佳答案
试试这个
.FormulaR1C1 = "=IFERROR(SUM(RC[-8]+RC[-7]/RC[-4])*" & NoofDays & ",0)"
关于vba - FormulaR1C1 包括变量 - 应用程序定义的错误 : Excel VBA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43207817/
以下是相关公式的一些原始数据:。当过滤使用时,我试图在上面的公式前面添加小计函数,但它不起作用……你能帮我吗?。筛选使用时,应使用总和除法加小计公式。Thx!
以下是相关公式的一些原始数据:。当过滤使用时,我试图在上面的公式前面添加小计函数,但它不起作用……你能帮我吗?。筛选使用时,应使用总和除法加小计公式。Thx!
我是一名优秀的程序员,十分优秀!