Capture data from 6 DDE links into one document

Dogbert7

New Member
Joined
Aug 10, 2010
Messages
3
Hello all,

I'm using the method described here: http://www.mrexcel.com/forum/showthread.php?t=211983&highlight=SetLinkOnData to log values from my DDE feed, only I've hacked it (using a little simple logic in lieu of my complete lack of VBA knowledge) to log multiple values.

The problem is that the values are updated across the row whenever any one of them changes, which makes things a little unwieldy for my purposes.

Would someone be kind enough to tell me how to separate the values out, such that an individual cell (and it's "Now" partner) is only appended on a change in its DDE link?

Here is what I did:

Private Const Bid_Quantity As String = "ESOTS|'SEP10 ALSI'!BIDQ"
Private Const Bid_Price As String = "ESOTS|'SEP10 ALSI'!BIDP"
Private Const Last_Price As String = "ESOTS|'SEP10 ALSI'!LASTP"
Private Const Ask_Price As String = "ESOTS|'SEP10 ALSI'!ASKP"
Private Const Ask_Quantity As String = "ESOTS|'SEP10 ALSI'!ASKQ"
Private Const Volume As String = "ESOTS|'SEP10 ALSI'!VOL"
Private Const RecordToSheetName = "Data"
Sub BeginRecordingUpdates()
ThisWorkbook.SetLinkOnData Bid_Quantity, "RecordUpdates"
ThisWorkbook.SetLinkOnData Bid_Price, "RecordUpdates"
ThisWorkbook.Sheets(RecordToSheetName).Cells.ClearContents
End Sub
Sub RecordUpdates()
Dim r As Long
With ThisWorkbook.Sheets(RecordToSheetName)
r = Application.WorksheetFunction.CountA(.Columns(1)) + 1
If r > 65535 Then StopRecordingUpdates
.Cells(r, 1).Value = ThisWorkbook.Sheets("DDE").Range("A2").Value
.Cells(r, 2).Value = Now
.Cells(r, 3).Value = ThisWorkbook.Sheets("DDE").Range("B2").Value
.Cells(r, 4).Value = Now
.Cells(r, 5).Value = ThisWorkbook.Sheets("DDE").Range("C2").Value
.Cells(r, 6).Value = Now
.Cells(r, 7).Value = ThisWorkbook.Sheets("DDE").Range("D2").Value
.Cells(r, 8).Value = Now
.Cells(r, 9).Value = ThisWorkbook.Sheets("DDE").Range("E2").Value
.Cells(r, 10).Value = Now
.Cells(r, 11).Value = ThisWorkbook.Sheets("DDE").Range("F2").Value
.Cells(r, 12).Value = Now
End With
End Sub
Sub StopRecordingUpdates()
ThisWorkbook.SetLinkOnData Bid_Quantity, ""
End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
OK, never mind on the above, I have figured it out. I set up a seperate subroutine to run on each DDE link's update.

Problem now is that I have 6 values in my "recorded price data table", but 5 of the values can't be logged past the 1st value. That's to say, until the 1st column updates and creates a new cell below its last recorded value, values in the next 5 columns can't create new cells. Any ideas?
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,442
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top