H!
我是 VBA 新手。
这可能是一个太简单的问题,但我正在努力使用 VBA:
当单元格(1,1)被点击时,因为它有1,消息框会显示“hi”
Sub test()
'click action 'when cell(1,1) is clicked and if cells(1,1) is 1, msgbox saying "hi" will show up, if not nothing If Cells(1, 1) = 1 Then
MsgBox "hi"
Else
End If
End Sub
此代码属于工作表模块。
右键单击工作表选项卡并选择“查看代码”
将此代码粘贴到此处:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target = 1 Then
MsgBox "hi"
End If
End If
End Sub
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)