Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Event procedure runs every time the worksheet recalculates

Private Sub Worksheet_Calculate()            Dim dProfit As Double            dProfit = Me.Range("A1").Value            If dProfit > 600 Then            MsgBox "Profit has risen to " & Format(dProfit, "#,##0.0"), vbExclamation            ElseIf dProfit < 500 Then            MsgBox "Profit has fallen to " & Format(dProfit, "#,##0.0"), vbCritical            End If      End Sub