晚安!
我试图制作一些excel声明,如下所示:
我想做的是:
if(A1=1 and B1=0) output would be A1=1 and B2=0
if(A1=0 and B1=1) output would be A1=0 and B2=1
if(A1=0 and B2=0) output is an error.
if(A1=1 and B2=1) output is an error.
if(A1="-"and B2="-") output would be A1="-" and B2="-".
同样适用于A和B的所有细胞。还有什么建议吗?
答案 0 :(得分:0)
您需要发布以下代码,以便在A列或B列中的任何内容更改为工作表对象时激活您的宏:
SELECT wz_name, wz_stand, wz_vistand, rep_wzrepstatus, vi_repstand FROM tbl_wz LEFT JOIN tbl_orders ON tbl_wz.IDWZ = tbl_orders.IDWZTBL LEFT JOIN tbl_vi ON tbl_wz.IDWZ = tbl_vi.VIWZID WHERE wz_stand='0' AND rep_wzrepstatus='0' ...
下面的代码将评估您的单元格中的条件,将在模块中进行:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Long
If Not Intersect(Target, Columns("A:B")) Is Nothing Then
Call Evaluatecells
End If
End Sub
如果您有任何问题,请与我们联系。