我在这里进退两难,我似乎就是想不出来。专业的vba用户也许能帮上忙。
基本上,我试图表明成品瓶-生料瓶是有限度的。如下所示。如果总计有超过208个原料瓶用于成品,则拒绝消息,如果少于,则继续进行。但同时如果少了50瓶原料瓶来做成品,那就不去发消息了。
因此,如果成品= 4000个原料瓶= 4212
消息将显示212瓶no go消息
如果成品= 4000个原料瓶= 3949
消息应显示51瓶no go消息
If Abs(.Cells(21, 3)) < 208 Or Abs(.Cells(21, 3)) < -50 Then
'# Display "go" message
.Cells(7, 5) = "All good, you may proceed to enter figures in EZY."
Else
'# Display "no-go" message
.Cells(7, 5) = "there is " & .Cells(21, 3) & " bottles less from Depal, do not enter in EZY!"
End If 'Check我希望这是有意义的。我可以嵌套大于和小于,还是在它下面键入另一个代码?如果我删除'Or Abs(.Cells(21,3)) < -50‘,整个代码就可以工作,但只适用于上限。
发布于 2021-01-19 08:44:24
如果按Raw - Finished计算,那么它应该是
If .Cells(21, 3) > 208 Or .Cells(21, 3) < -50 Then否则,如果按Finished - Raw计算,那么它应该是
If .Cells(21, 3) < -208 Or .Cells(21, 3) > 50 Then通过使用Abs,您将无法辨别该值是低于还是高于"4000“。
发布于 2021-01-21 02:29:56
最后,这就解决了问题。谢谢!
'# If D - F - Wastes is within +/- 50...
If .Cells(21, 3) < 208 And .Cells(21, 3) > -50 Then
'# Display "go" message
.Cells(7, 5) = "All good, you may proceed to enter figures in EZY."
Else
'# Display "no-go" message
.Cells(7, 5) = "there is " & .Cells(21, 3) & " bottles less from Depal, do not enter in EZY!"
End If 'Checkhttps://stackoverflow.com/questions/65783679
复制相似问题