Using Named Range in Worksheet_Change event

G

Guest

I have the following IF statement in my worksheet_Change event

If Not Intersect(Target, Range("A1:A20")) Is Nothing Then


I'd like to replace "A1:A20" with a named range. What do I need to change
to get this to work. Let's say the named range is "BARB" for this example.

Thanks,
Barb Reinhardt
 
B

Bob Phillips

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("BARB")) Is Nothing Then
With Target
'do your stuff
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top