Reputation: 23
I have a very simple piece of code, just trying to determine if a change was made to a named cell. Of course most cells do not have names associated with them resulting in err 1004. None of the error trapping methods seems to work (on error resume next, on error goto 0). How do I solve this?
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo 0
If Target.Name.Name = "IDLOPT" Then Call ChangeToLine
End Sub
Upvotes: 0
Views: 77
Reputation: 14373
Please try this code.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Name.Name = "IDLOPT" Then
If Err = 0 Then Call ChangeToLine
End If
End Sub
Upvotes: 0
Reputation: 1265
Try this ...
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, ActiveSheet.Range("IDLOPT")) Is Nothing Then
Call ChangeToLine
End If
End Sub
Upvotes: 2