B1 = last traded price of crude oil futures ( get through DDE link so keeps changing every sec ) e.g. 6500
B2 & B3 ( I define the range so if B1 goes between the value specified in B2 and B3 then run another macro ( Call BuyBeansSellProducts ) which will enter multiple Buy Orders in to exchange) B5 & B6 ( i define range for running macro will send Sell Orders ) - Call SellBeansBuyProducts Till yesterday my code was running smoothly just today something happened it stopped reacting and if B1 value goes between values specified in B5 and B6 nothing happens, it doesnt run SellBEANSBUYPRODUCTS macro...but at the same time...it works great for BuyBeansSellProducts macro... On Jul 21, 1:26 pm, Paul Schreiner <schreiner_p...@att.net> wrote: > Have you tried setting a breakpoint and see if > what it is actually doing by stepping through the code? > > and.. what do you mean that it stopped "recognizing" range 3 and 4? > > What are the values you're testing? > B1 = > B2 = > B3 = > B4 = > > Paul > > ________________________________ > From: TAlgo <trading.a...@gmail.com> > To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com> > Sent: Tuesday, July 21, 2009 10:27:17 AM > Subject: $$Excel-Macros$$ Calculation Event Macro Stopped Working > > hello, > > I was successfully using the following code as entering orders to > trade commodity futures in to exchange. > > Private Sub Worksheet_Calculate() > Const WS_RANGE As String = "B1" '<== change to suit > On Error GoTo ws_exit > If Range(WS_RANGE).Value = oldval Then Exit Sub 'value has not changed > oldval = Range(WS_RANGE).Value > Application.EnableEvents = False > If Range(WS_RANGE).Value > Range("b2") And Range(WS_RANGE).Value < > Range("b3") Then 'range 1 and range 2 > Call BuyBeansSellProducts > End If > If Range(WS_RANGE).Value >= Range("b5") And Range(WS_RANGE).Value < > Range(" b6") Then 'range3 and range4 > Call SellBeansBuyProducts > End If > ws_exit: > Application.EnableEvents = True > End Sub > > The problem is; my code suddenly stopped recognizing range 3 and range > 4 and dpes not call SellBEANBUYPRODUCTS anymore but works greate for > range1 and range2 and calls BUYBEANSSELLPRODUCTS... > > When i run seperately SellBeansBuyProducts macro it also runs without > any issues.. > > Any idea what is causing it? --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 5,000 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---