preparedit 代码目的: 表有3列 A列 B列 C列 行间公式是C=A*B
现在要做的是:当A列没数值或数值是0时 C列直接手工输入 (并且不受重置列影响)
否则 C=A*B ,并且C禁止修改(尽管可以重置列)
preparedit 代码
If e.Col.Name = "C列" Then
If e.DataRow.isnull("A") Then
e.Cancel = False
Else
e.Cancel = True
End If
End If
datacolchanged 代码:
Select Case e.DataCol.Name
Case "A列","B列"
If e.DataRow.isnull("A列") OrElse e.DataRow.isnull("B列") Then
e.DataRow("C列)=Nothing
Else
e.DataRow("C列")=e.DataRow("A列")*e.DataRow("B列")
End If
End Select
出现问题:C列当A列有数值时,还是能修改
C列当A列没有数值时,能修改,但是重置列后改为原来数值或0