我似乎听不懂第二句话:
If Not CBool(GetKeyState(vbKeyRButton) And &H8000)请您用简单的英语解释一下这句话的意思好吗?我所能理解的就是“如果不是”和“我对这里所有的VBA奇才有很强的信心!”请帮帮我!
完整的代码如下:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not CBool(GetKeyState(vbKeyRButton) And &H8000) Then
If IsEmpty(strBoardSize) Then
Exit Sub
End If
Else
End if
Sub endstrBoardSize是表的大小,以前是
Dim strBoardSize as string发布于 2015-11-08 22:41:47
根据这个页面,CBool方法接受任何输入,并尝试对值进行布尔比较。
所以,用英语:
If the value returned by (GetKeyState(vbKeyRButton) And &H8000) is not true, then:
If IsEmpty(strBoardSize) Then
Exit Sub
End If
Else
End if另一种看待这一问题的方法是:
Dim LCompare as Boolean
LCompare = CBool(GetKeyState(vbKeyRButton) And &H8000) 'Sets the value returned from CBool in LCompare
If Not LCompare Then
If IsEmpty(strBoardSize) Then
Exit Sub
End If
Else
End if这个其他条款解释了GetKeyState的输入是什么,以及它们对按位运算符的影响。
希望这能帮点忙..。
https://stackoverflow.com/questions/33599782
复制相似问题