【发布时间】:2014-09-23 10:47:15
【问题描述】:
我正在尝试写一个随列变化的方程,一般方程是相同的。
即有 A、B 和 C 列,公式在 C 列中显示结果。 一般方程 = C1(一个初始结果)+(B3+B1)/2 *(A3-A1) 将在下一行更新为
=C2+(B4+B2)/2*(A4-A1) 依此类推,顺着柱子往下走
除此之外,当A列中没有值时,我在C列中添加了*,我目前编写的代码如下所示,我真的希望有人能帮助我谢谢
''''row number = row number + 1 on a loop
Worksheets("Sheet3").Cells(19, 1) = 0 '''this is A1=0
Worksheets("Sheet3").Cells(19, 3) = 0 '''This is C1 = 0
If Worksheets("Sheet3").Cells(19 + row_number, 1) = "" Then
''''if cell in A column is blank show * in column C
Usui_wear_depth = "*"
Else: Usui_wear_depth = Application.WorksheetFunction.Sum(Sheet3.[C22] + (([B25] + [B22]) / 2) *
([A25] - [A21])) ''' this is the General equation
End If
Worksheets("Sheet3").Cells(19 + row_number, 6) = Usui_wear_depth
【问题讨论】:
标签: excel vba if-statement sum equation