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
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Dogbert7

New Member
Joined
Aug 10, 2010
Messages
3
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?
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,781
Messages
5,513,408
Members
408,950
Latest member
bndouglas

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top