1.右擊EXCEL工作表的表名,選擇檢視程序碼.
2.將程序區左上方的內容選為WorkSheet,然后選擇右邊下拉框的Change事件.
3.代碼如下.(我對VBA也不熟,看幫忙寫的)
Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(Target.Row, Target.Column) = "" Then
Exit Sub
End If
If UCase(Cells(Target.Row, Target.Column)) = "Y" Then
Cells(Target.Row, Target.Column) = "Y"
Else
Cells(Target.Row, Target.Column) = "N"
End If
End Sub