VBA 类模块如何写一个单击触发事件继

2025-01-08 09:17:16
推荐回答(1个)
回答1:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 And Target.Row = 1 Then
MsgBox "你选中了:" & Target.Text
End If
If Target.Column = 3 And Target.Row = 5 Then
MsgBox "你选中了:" & Target.Text
End If
End Sub
当你点击A1时,会弹出“你选中了美女”
当你点击C5时,会弹出“你选中了俊男”