Hello, the following code that I have finds a value based on input and then inserts a line, this all works correctly however after the line is inserted I get an runtime error 13, as far as I can see this is due to the line:
"If Target = 0 Then Exit Sub"
I have attempted changing the equals to a string, I have tried changing the formatting of the row being inserted but without any joy, any help would be appreciated.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target = 0 Then Exit Sub
Dim fn As Range
If Not Application.Intersect(Range("A:A"), Target) Is Nothing Then
Set fn = Columns(3).Find(Target.Value, , xlValues, xlWhole, searchdirection:=xlPrevious)
If Not fn Is Nothing Then
fn.EntireRow.Select
Selection.insert Shift:=xlDown
Else
MsgBox "Location not found", vbInformation
End If
End If
End Sub
Bookmarks