Consulting

Results 1 to 5 of 5

Thread: Worksheet_Change and RTD Link

  1. #1
    VBAX Tutor
    Joined
    Sep 2008
    Posts
    213
    Location

    Worksheet_Change and RTD Link

    I am using an RTD link to pull data from my trading platform to excel. I am trying to record the data everytime it changes. I am currently attempting to use Worksheet_Change but even when the data in the cell with the RTD link changes it doesn't seem to be recognizing the change and therefore not executing the recording macro. (The macro worked fine during testing with manual changes to the cells).

    Is there anyway around this to have excel recognize the changes in the RTD linked value?

    Thanks

  2. #2
    VBAX Tutor
    Joined
    Sep 2008
    Posts
    213
    Location
    Here is a copy of what I am working with if that helps
    Attached Files Attached Files

  3. #3
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    The change event only responds to a change in literal values, not formulas. I do not know of any particularly good solutions - you could use the calculate event and test the range for changes (you need to store the old values each time, either in an array, or in the cell's ID property for example) as one option.
    Be as you wish to seem

  4. #4
    VBAX Tutor
    Joined
    Sep 2008
    Posts
    213
    Location
    Aflatoon, thanks. Yes it looks like I got change mixed up with calculate.
    as a short term fix I have placed each value on a different sheet. Probably not the most efficient way, but it seems to be working for me at the moment.
    If anyone has any links to any examples on how to store the old value as Aflatoon mentions it would be much appreciated however!!

    Thanks again!!

  5. #5
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    It is not clear to me where you want to store the data, but basically

     Dim varData
    
    Private Sub Worksheet_Activate()
       varData = Range("B3:F3").Value
    End Sub
    
    Private Sub Worksheet_Calculate()
       Dim n                 As Long
       With Range("B3:F3")
          For n = 1 To .Cells.Count
             If varData(1, n) <> .Cells(n).Value Then
                MsgBox "Changed value: " & .Cells(n).Value & " was " & varData(1, n)
             End If
          Next n
       End With
    End Sub
    Be as you wish to seem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •