ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Named Range in Worksheet_Change event (https://www.excelbanter.com/excel-programming/366894-using-named-range-worksheet_change-event.html)

Barb Reinhardt

Using Named Range in Worksheet_Change event
 
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

Jim Thomlinson

Using Named Range in Worksheet_Change event
 
try this...

If Not Intersect(Target, Range("BARB")) Is Nothing Then
--
HTH...

Jim Thomlinson


"Barb Reinhardt" wrote:

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


Bob Phillips

Using Named Range in Worksheet_Change event
 
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)

"Barb Reinhardt" wrote in message
...
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





All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com