作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这可能是一个我忽略的简单问题。我有一个 for 循环拒绝按照给定的时间间隔加紧。下面的代码是从更复杂的代码中提取的。我的程序运行了 1 小时,没有任何变化,我设法将其缩小到导致运行时间过长的部分。
我试过在它自己的模块中运行这段代码,同样的问题发生了。我在主要代码块中有其他 for 循环与 step
没有问题就是这个。任何帮助找到我出错的地方将不胜感激。
Sub Test()
Dim h As Long
Dim BiezerP0 As Double
Dim BiezerP1 As Double
Dim BiezerP2 As Double
Dim BiezerP3 As Double
Dim BiezerValue As Double
Dim BiezerStepInterval As Double
Dim BiezerLocation As Double
Dim P0Time As Double
BiezerStepInterval = 0.167
For h = 0 To 1 Step BiezerStepInterval
BiezerP0 = ((1 - h) ^ 3) * P0
BiezerP1 = 3 * ((1 - h) ^ 2) * h * P1
BiezerP2 = 3 * (1 - h) * h * h * P2
BiezerP3 = h * h * h * P3
BiezerValue = BiezerP0 + BiezerP1 + BiezerP2 + BiezerP3
BiezerLocation = h * BiezerSteps
Cells(BiezerLocation + 4, 15) = BiezerValue
Cells(BiezerLocation + 4, 16) = P0Time + (0.02 * BiezerLocation)
Next h
End Sub
最佳答案
h应该是Double,不长
Dim h As Double
关于vba - 为什么我的 for 循环没有加紧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48205249/
我是一名优秀的程序员,十分优秀!