Run Macro based on value in a cell


Posted by Werner on August 17, 2000 12:43 PM

I have a spreadsheet with DDE links to process equipment. The process variables are all listed in a column. In addition, all these values are represented in a bar graph in another worksheet. If the process value exceeds a limit I would like to turn the graph from blue to red (Process in Alarm) Is there a simple way to activate a macro automatically (excel 7)based on the value in a cell? If anyone has done something similar, I would appreciate any assistance that can be offered.

Thank You



Posted by Tim Francis-Wright on August 17, 0100 2:01 PM


You can set a Worksheet_Calculate sub in the appropriate sheet object, assuming that
the cell you want is a calculated cell and
not an input cell:

Private Sub Worksheet_Calculate()
' change RangeName to the range you need
If Range("RangeName").Value > Limit Then
AlarmSub ' run the alarm sub

End If
End Sub

HTH