View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ALVESM ALVESM is offline
external usenet poster
 
Posts: 6
Default pause/re-run macro to enable DDE updating

hello, please check the macro i've writen:

Sub Macro1()

Dim i As Integer

For i = 1 To 100000
If Worksheets("sheet1").Range("PXLAST").Value =
Worksheets("sheet1").Range("init").Offset(i, 0).Value Then
Else
Worksheets("sheet1").Range("PXLAST").Copy
Worksheets("sheet1").Range("init").Offset(i, 0).PasteSpecial
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
Next

End Sub

*on the PXLAST cell i have a formula that gets updated via a DDE link:
=blp("ukx index", "last price")
*this returns the real time price of FTSE100
my macro is supposed to copy this value down 100000 times or so whenever
there is a change from prev value.
*however i can't get the PXLAST cell to get updated while the macro is
running, so i wanted to introduce a pause in the programming that would allow
the DDE to update before having the macro running again.
*my code is also no working properly because the macro will execute the ELSE
even if the IF clause is verified. as at now, my macro is copying down 6527.6
all the time.

can you help me out with code suggestions?

much appreciated.