+ Reply to Thread
Results 1 to 3 of 3

Flash Background Color when Cell Link Changes

  1. #1
    Registered User
    Join Date
    08-10-2005
    Posts
    3

    Flash Background Color when Cell Link Changes

    How do you tell Excel to only change the background color of a single cell if it's formula has changed?

    I have a sheet that is linked via a formula to a live commodity feed (Column C). I am trying to flash a background color of yellow every time the cell price changes. If the linked formula in c2 changes then only cell c2 should flash the background color of yellow. I have the following so far,

    Private Sub Worksheet_Calculate()
    Dim newColor As Integer
    Dim c, myCell As Range
    Dim x As Integer
    Dim fSpeed

    Set myCell = Range("c2:c62")
    'Make cell background flash to this color!
    newColor = 27
    'Make the cell range flash fast: 0.01 to slow: 0.99
    fSpeed = 0.5
    DoEvents
    Start = Timer
    Delay = Start + fSpeed
    Do Until Timer > Delay
    DoEvents
    myCell.Interior.ColorIndex = newColor
    Loop
    Start = Timer
    Delay = Start + fSpeed
    Do Until Timer > Delay
    DoEvents
    myCell.Interior.ColorIndex = xlNone
    Loop
    End Sub

    Unfortunately my entire range flashes a yellow background when any of the prices change. Thank you in advance for your assistance.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    The only way i now of doing it is by tracking the value of c2 and testing if it changes.

    try

    Static CellC2 as integer

    if cellc2 <> range("c2").value then
    cellc2=range("c2").value
    run flash code
    end if

  3. #3
    Registered User
    Join Date
    08-10-2005
    Posts
    3
    mudraker

    Thank you for the assistance, I greatly appreciate your help! The code is working flawlessly.

+ 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