0
我一直在试图检查用户是否从某个特定的Range
单元中失去了焦点。失去焦点后检查相交
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldRange As Range
Dim AmountCol As String * 1
Dim PayedCol As String * 1
Dim MyRange As Range
If (Not OldRange Is Nothing) Then
AmountCol = Chr(Asc(Range("B1").Text) + 1)
PayedCol = Chr(Asc(Range("B1").Text) + 2)
Set MyRange = Range(AmountCol & ":" & AmountCol)
If Not MyRange Is Nothing And Not OldRange Is Nothing Then
If Not Intersect(OldRange, MyRange) Then
MsgBox Chr(Asc(Range("B1").Text) + 1) & ":" & Chr(Asc(Range("B1").Text) + 1)
End If
End If
End If
Set OldRange = Target.Cells(1, 1)
End Sub
有人能帮我理解这有什么问题吗?代码与If Not Intersect(OldRange, MyRange) Then
断行。
如何围绕去掉括号'不OldRange是Nothing' – Luuklag