+ Reply to Thread
Results 1 to 3 of 3

Need code to run when value referenced changes

  1. #1
    Registered User
    Join Date
    05-18-2011
    Location
    Aurora, CO
    MS-Off Ver
    Excel 2002
    Posts
    2

    Need code to run when value referenced changes

    Hello,

    I need code to run when a cell’s referenced value changes, not when the cell content changes. In other words, the cell contains this formula, which doesn’t change:

    =Telem|RealTime!‘Lap Number’

    Each time the driver goes by the beacon, the lap number information is updated, and that is when I need the code to run. Since the actual content of the cell as shown above does not change, the code (I’m currently using Worksheet_Change) doesn’t run.

    More detail: I am using DDE to populate the Excel spreadsheet, and what I am trying to record automatically is the lap time for each lap. The final desired result will look something like this:

    Lap Lap time
    1 128.29
    2 127.33
    3 128.40
    4 127.01


    I have code that records this information IF I enter something in the target cell, but I need it to recognize that the referenced value has changed and run automatically.

    From what I’ve read, it appears as though I may be abel to use copy/pastespecial to paste the value into a cell, but I’m not sure of the code or where it would go.

    Another option I wonder about is if there is a way to pass just the value in =Telem|RealTime!‘Lap Number’ to another cell in Excel and then have the code run based on changes to that cell.

    Please advise. Any help is appreciated.

    Thank you!
    Attached Files Attached Files
    Last edited by DTUchange; 05-23-2011 at 10:06 PM. Reason: Solved

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: Need code to run when value referenced changes

    You can use Worksheet_Calculate but it's a bit of a workaround to get it to limit the calculation to one specific cell (in this case Cell A1 on Sheet1):

    First declare the public variable olval.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-18-2011
    Location
    Aurora, CO
    MS-Off Ver
    Excel 2002
    Posts
    2

    Re: Need code to run when value referenced changes

    Thank you, mojo249! That's what I needed!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1