+ Reply to Thread
Results 1 to 2 of 2

Cell Change Color - Need Help

  1. #1
    alani
    Guest

    Cell Change Color - Need Help


    Hi All,

    I wonder if anyone can help me on this. I'm working on something which
    will help me to monitor inputs. e.g. A system will send a heartbeat
    every minute which I will be able capture as input to my excel
    spresheet, say cell C3. Now, this are the requirement for the output:

    If cell C3 is updating every minute consistently then cell A1 will
    remain or change to GREEN.

    If cell C3 is not updating after 1minute 30seconds then cell A1 will
    change to AMBER but if it is updating again cell A1 will change to
    GREEN again.

    If cell C3 is not updating after 2minutes the cell A1 will change to
    RED but if it is updating again cell A1 will change to GREEN again.

    Cell C3 will stop receiving update from 7pm to 7am next day. During
    this period, cell A1 will change to GREY.

    The whole process repeats itself again excluding Saturday, Sunday and
    Public holidays.


    --
    alani

  2. #2
    Bob Phillips
    Guest

    Re: Cell Change Color - Need Help

    Alani,

    You could try this.

    Put this code in the worksheet code module

    Private Sub Worksheet_Change(ByVal Target As Range)

    On Error GoTo ws_exit:
    Application.EnableEvents = False
    If Not Intersect(Target, Me.Range("C3")) Is Nothing Then
    With Target
    .Interior.ColorIndex = 4
    End With
    End If
    Application.OnTime nTime, "TurnGreen", ,False
    nTime = Now + TimeSerial(0, 1, 0)
    Application.OnTime nTime, "TurnGreen"

    ws_exit:
    Application.EnableEvents = True
    End Sub

    'This is worksheet event code, which means that it needs to be
    'placed in the appropriate worksheet code module, not a standard
    'code module. To do this, right-click on the sheet tab, select
    'the View Code option from the menu, and paste the code in.


    and this in a standard code module

    Public nTime As Double

    Public Sub TurnGreen()
    nTime = Now + TimeSerial(0, 1, 0)
    Range("C3").Interior.ColorIndex = 45
    Application.OnTime nTime, "TurnGreen"
    End Sub


    --
    HTH

    Bob Phillips

    "alani" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi All,
    >
    > I wonder if anyone can help me on this. I'm working on something which
    > will help me to monitor inputs. e.g. A system will send a heartbeat
    > every minute which I will be able capture as input to my excel
    > spresheet, say cell C3. Now, this are the requirement for the output:
    >
    > If cell C3 is updating every minute consistently then cell A1 will
    > remain or change to GREEN.
    >
    > If cell C3 is not updating after 1minute 30seconds then cell A1 will
    > change to AMBER but if it is updating again cell A1 will change to
    > GREEN again.
    >
    > If cell C3 is not updating after 2minutes the cell A1 will change to
    > RED but if it is updating again cell A1 will change to GREEN again.
    >
    > Cell C3 will stop receiving update from 7pm to 7am next day. During
    > this period, cell A1 will change to GREY.
    >
    > The whole process repeats itself again excluding Saturday, Sunday and
    > Public holidays.
    >
    >
    > --
    > alani




+ 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