Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro run from if then function
The code below only runs if the Target.Address = "$A$1" . If i change the
Target.Address to ="$B$1" and make a change to cell B1 the macro won't run. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then Application.Run "Test_Output_file!Macro1" End If End Sub Thanks in advance for any help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro run from if then function
I wasn't using uppercase B in the Target. Address. Now it's working fine.
"ram" wrote: The code below only runs if the Target.Address = "$A$1" . If i change the Target.Address to ="$B$1" and make a change to cell B1 the macro won't run. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then Application.Run "Test_Output_file!Macro1" End If End Sub Thanks in advance for any help |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro run from if then function
Hi,
you are comparing two strings, so you have to be sure that they will be the same (if target.address is "$B$1" and in your condition you have Target.Address = "$b$1", then these two strings don't match). There are many ways how to do it: If Target.Address = range("b1").address Then or if not intersect(target,range("b1") is nothing then for example. Regards, Ivan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Should I use a macro for this function? | Excel Discussion (Misc queries) | |||
Sub Macro vrs Function Macro Auto Start | Excel Discussion (Misc queries) | |||
Macro Function | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
Is this a macro or a function? | Excel Programming |