For k = 0 To (.Cells(38, 4).Value - 1)
For i = 70 To 73
For j = 0 To 2
If j = 0 Then
bumpvalue = k * (.Cells(39, 4).Value + .Cells(31, 4).Value)
Else
bumpvalue = 0
End If
StartPoint(j) = .Cells(i, 8 + j).Value + bumpvalue
EndPoint(j) = .Cells(i + 1, 8 + j).Value + bumpvalue
Next j
Set lineObj = DWGFile.ModelSpace.AddLine(StartPoint, EndPoint)
Next i
Next k
有没有更好的位置或方法来实现仅在j = 0时适用的“凸点值”?
下面告诉我的东西不会飞。
StartPoint(j) = .Cells(i, 8 + j).Value + if j = 0 then k * (.Cells(39, 4).Value + .Cells(31, 4).Value) else 0
答案 0 :(得分:2)
您的想法非常接近。尝试使用IIf
语句:
StartPoint(j) = .Cells(i, 8 + j).Value + IIf(j = 0, k * (.Cells(39, 4).Value + .Cells(31, 4).Value), 0)