Hello all. Using Excel 2003 with WinXP. I'm trying to run macro code automatically whenever time = 9:30:01 (or whatever time I pick) for a stock market trading program, which is why the exact time matters so much. I've been able to get the time to update fine, but unless I click on the worksheet while the time condition is TRUE then my code doesn't run. The time actually is sent to me from the stock data provider and it shows up in a cell as a constantly updating value.
I've tried using the Workbook_SheetChange function and OnTime method, but without luck. In both cases, unless I activate the sheet the code doesn't run. By activate, I mean that I have to click on the sheet when the values that trigger the code to run would be true. If I do that it works just fine, but sitting around and clicking on a worksheet defeats the purpose of automation. Since I'm trading stocks this has to be very exact, so I can't trust a macro scheduler to do this.
The code further below is what I'm trying to get to run. The time value is in cell L1. In cell L2 I have the following code:
That turns to True at 9:30:01 and false before and after that time. The code below checks cell L2 and then runs the code below that. It works just fine when I click on L2 and the result is True, but unless I manually "activate" the cell the result will turn to True but not run the code.![]()
Please Login or Register to view this content.
Placed in ThisWorkbook:
Any help on this would be greatly appreciated. Thanks.![]()
Please Login or Register to view this content.
Bookmarks