我对此仍然比较陌生,并试图找到答案。也许它没有正确定义或根本没有定义。也许它不是指向正确的工作表。我不太确定...任何帮助将不胜感激!谢谢!运行时错误'1004':对象'_Global'的方法'相交'失败
获取有关此行错误:
Set Inte = Intersect(A, Target)
错误代码是:
Run-time error '1004': Method 'Intersect' of object'_Global' failed
全码:
Private Sub Worksheet_Change(ByVal Target As Range)
'Determine Target Colunm
If Target.Column = 10 Then
'Check for "TD", Copy/Delete Row if found
If Target = "TD" Then
Application.EnableEvents = False
nxtRow = Sheets("TD Locks").Range("J" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy _
Destination:=Sheets("TD Locks").Range("A" & nxtRow)
Target.EntireRow.Delete
Application.EnableEvents = True
Exit Sub
End If
'Check for "Closed", Copy/Delete Row if found
If Target = "Closed" Then
Application.EnableEvents = False
nxtRow = Sheets("Closed Locks").Range("J" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy _
Destination:=Sheets("Closed Locks").Range("A" & nxtRow)
Target.EntireRow.Delete
Application.EnableEvents = True
End If
End If
'Adds date when borrower name is entered
Dim A As Range, B As Range, Inte As Range, r As Range
Set A = Range("C:C")
Set Inte = Intersect(A, Target)
If Inte Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each r In Inte
If r.Offset(0, 8).Value = "" Then
r.Offset(0, 8).Value = Date
End If
Next r
Application.EnableEvents = True
End Sub
使用'Application.Intersect'尝试 – PeterT