Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto execute a macro if a cell value=1 ?
Hi, I have looked at the suggested link from cpearson.com but I still don' get the macro to be executed. The macro itself is working fine and i executes fine when I start it manually. But what I'm looking for is t auto-start the macro called MacroX every 60 seconds only if the cel B3=1 If the cell is not exacley 1 , do nothing. I have tried the following code but I cannot get it to work: Private Sub Worksheet_Change(ByVal Target As Range) Set i = Application.Intersect(Target, Range("B3")) If Not i Is Nothing And Target.Value = 1 Then MacroX Application.OnTime Now + TimeValue("00:01:00"), "MacroX" End Sub The name of the sheet is called MySheet but I guess that doesn' matter. Thanks for all the help so far, Sve -- Sve ----------------------------------------------------------------------- Sven's Profile: http://www.excelforum.com/member.php...nfo&userid=954 View this thread: http://www.excelforum.com/showthread.php?threadid=21954 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto execute a macro if a cell value=1 ?
Hi
you have to put this code in your worksheet module and not in a standard module: - right-click on your tab name - choose 'Code' - now paste your code "Sven" wrote: Hi, I have looked at the suggested link from cpearson.com but I still don't get the macro to be executed. The macro itself is working fine and it executes fine when I start it manually. But what I'm looking for is to auto-start the macro called MacroX every 60 seconds only if the cell B3=1 If the cell is not exacley 1 , do nothing. I have tried the following code but I cannot get it to work: Private Sub Worksheet_Change(ByVal Target As Range) Set i = Application.Intersect(Target, Range("B3")) If Not i Is Nothing And Target.Value = 1 Then MacroX Application.OnTime Now + TimeValue("00:01:00"), "MacroX" End Sub The name of the sheet is called MySheet but I guess that doesn't matter. Thanks for all the help so far, Sven -- Sven ------------------------------------------------------------------------ Sven's Profile: http://www.excelforum.com/member.php...fo&userid=9548 View this thread: http://www.excelforum.com/showthread...hreadid=219545 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Auto Execute Macro | Excel Discussion (Misc queries) | |||
Auto Execute Macro | Excel Worksheet Functions | |||
Auto-execute macro.... | Excel Discussion (Misc queries) | |||
Auto execute a macro if a cell value=1 ? | Excel Programming | |||
Auto execute a macro if a cell value=1 ? | Excel Programming |