打开excel 文件 按下ALT+F11快捷键打开Microsoft visual Basic 以话框,单击ThisWorkbook,然后填入以后语句保存即可
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Address = "$B$1" Then ‘单击B1
Target.Value = Target.Value + 1
End If
If Target.Address = "$B$2" Then ’单击B2
Target.Value = Target.Value + 1
End If
If Target.Address = "$B$3" Then
Target.Value = Target.Value + 1
End If
If Target.Address = "$B$4" Then
Target.Value = Target.Value + 1
End If
End Sub