Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Change event triggered by a named range

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Change event triggered by a named range

Hi,
you may be able to overcome something like insertion of rows by naming the
range, but i am not sure if this addresses your question.
--
David


"Sean" wrote:

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change event triggered by a named range


In the new version of Visual Studio 2005
There are tools for developing office applications.
You can write code that will target the on change event of a name
range.

There is only a beta version available of VSTO
And you have to write it in VB.net or C#.net.

If you want to know more about this option let me kno

--
Kaa
-----------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...nfo&userid=751
View this thread: http://www.excelforum.com/showthread.php?threadid=39119

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Change event triggered by a named range

Thanks Norman, Works a treat, even made sense after I thought about it.

Sean

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Event on a named range GregR Excel Programming 2 July 12th 05 09:37 PM
Macro triggered by an event AussieAVguy Excel Discussion (Misc queries) 2 June 16th 05 05:51 AM
Event triggered by cell data change/entry Fred Holmes Excel Programming 3 March 17th 05 02:13 PM
Help - Change Event triggered on File Save As Dee Veloper Excel Programming 4 October 29th 03 02:16 AM
Event triggered by Hiding/Unhiding columns? Jerry W. Lewis Excel Programming 1 July 23rd 03 09:17 AM


All times are GMT +1. The time now is 07:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"