第1个回答 2010-08-17
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
If Target.Value = "否" And Target.Offset(, -1) = "是" And Target.Offset(0, -2) = "是" Then Target.Offset(0, 1) = "A"
If Target.Value = "否" And Target.Offset(, -1) = "否" And Target.Offset(0, -2) = "否" Then Target.Offset(0, 1) = "B"
End If
End Sub
在事件里插入代码,此代码只是简单,写了下,一列二列有数,三列输数才起作用,若改变书写习惯,此代码还应修改下
第2个回答 2010-08-17
Sub main()
For i = 1 To 65536
If Cells(i, 1) = "是" And Cells(i, 2) = "是" And Cells(i, 3) = "否" Then Cells(i, 4) = "A"
If Cells(i, 1) = "否" And Cells(i, 2) = "否" And Cells(i, 3) = "否" Then Cells(i, 4) = "B"
If Cells(i, 1) = "" Then Exit For
Next
End Sub
把上面的代码在VBA里运行一下,看是否能达到你的要求!本回答被网友采纳