ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Cell Change Color - Need Help (https://www.excelbanter.com/new-users-excel/32770-cell-change-color-need-help.html)

alani

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.

Bob Phillips

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" wrote in message
...

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




alani

Hi Bob,

Thanks for the quick reply. I've tried it but it didn't work as expected or maybe i did something wrong. I've already click and paste the script as instructed but no change. I've attached a screenshot of what I intend to do. For column A will be the timer which will be updating according to my earlier description. Column B is the System name and column C is the Status which I need help.

Thanks again Bob.

Bob Phillips

Not sure Alani.

Why don't you send me your workbook direct, and I will install it.

--
HTH

Bob Phillips

"alani" wrote in message
...

Hi Bob,

Thanks for the quick reply. I've tried it but it didn't work as
expected or maybe i did something wrong. I've already click and paste
the script as instructed but no change. I've attached a screenshot of
what I intend to do. For column A will be the timer which will be
updating according to my earlier description. Column B is the System
name and column C is the Status which I need help.

Thanks again Bob.


--
alani





All times are GMT +1. The time now is 04:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com