View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Change event triggered by a named range

Hi Sean,

Try:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("Test")) Is Nothing Then
MsgBox "Hello"
End If
End Sub

Replace Test withyour range name.


---
Regards,
Norman



"Sean" wrote in message
oups.com...
Hi,

I have a event on a worksheet that is triggered when cell $A$5 is
changed. The problem is when cells are inserted or deleted from the
sheet then I need to update my macro.

Is there a way to target a named range?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$5" Then
MsgBox "Hello"
End If
End Sub

Works

but

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "range name" Then
MsgBox "Hello"
End If
End Sub

Does not.

Any assistance will be appreciated.

Regards.

Sean