TTom
Well-known Member
- Joined
- Jan 19, 2005
- Messages
- 518
I want to trigger a macro to run when my named cell range changes.
I have a cell named as range: rng_trigger
In the 'In Worksheet_Change Module'
on first line of code shown below (after Dim statement):
If I use for code:
Set myTriggerCell = Range("rng_trigger")
then:
myTriggerCell = the row# of the cell named "rng_trigger", not the address
If I use for code:
Set myTriggerCell = Range("rng_trigger").Address
then:
it sees the named range as an error and hangs the macro...
Any suggestions?
<code>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myTriggerCell As Range
Set myTriggerCell = Range("rng_trigger").Address
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Call myMacro
Else:
'Do Nothing
End If
End Sub
</code>
I have a cell named as range: rng_trigger
In the 'In Worksheet_Change Module'
on first line of code shown below (after Dim statement):
If I use for code:
Set myTriggerCell = Range("rng_trigger")
then:
myTriggerCell = the row# of the cell named "rng_trigger", not the address
If I use for code:
Set myTriggerCell = Range("rng_trigger").Address
then:
it sees the named range as an error and hangs the macro...
Any suggestions?
<code>
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myTriggerCell As Range
Set myTriggerCell = Range("rng_trigger").Address
If Not Application.Intersect(myTriggerCell, Target) Is Nothing Then
Call myMacro
Else:
'Do Nothing
End If
End Sub
</code>