What is wrong with this code?
It is usually best to tell us what is happening rather than just asking
what's wrong with code. You should give any errors, where/when it occurs,
etc.
I'm guessing that there may be an issue with "If .Count..."
I could be wrong, but Target.Count seems to produce an error.
There may be other problems, but look into that.
Regards,
Paul
--
"Ayo" wrote in message
...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim RF_Table As Range, RF As Range
Set RF_Table = Worksheets("Sheet3").Range("H2:J5").Cells
Set RF = Range("P4:P2000")
Application.ScreenUpdating = False
With Target
If .Count 1 Then Exit Sub
If Not Intersect(RF, .Cells) Is Nothing Then
If Not IsEmpty(Target) Then
Application.EnableEvents = False
With .Offset(0, 1)
.Value =
Application.WorksheetFunction.VLookup(Target, RF_Table, 2, False)
End With
Application.EnableEvents = True
End If
End If
End If
End With
End Sub
|