View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_5_] Jim Thomlinson[_5_] is offline
external usenet poster
 
Posts: 486
Default Message Box if sum is above 30

Here is some code to try. It is a bit overkill if you only have constants in
A3:C3 but it will work. Place this code directly in the sheet (Right click
the sheet tab and select view code)

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
On Error Resume Next
Set rng = Intersect(Range("A1:A3"), Target.Dependents)
If rng Is Nothing Then Set rng = Intersect(Range("A1:A3"), Target)
On Error GoTo 0
If Not (rng Is Nothing) And Application.Sum(Range("A1:A3")) 30 Then
MsgBox Application.Sum(Range("A1:A3"))
End If
End Sub
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

Are A3, B3 and C3 constants or formulas or a mixture of the two?
--
HTH...

Jim Thomlinson


"Elaine" wrote:

If A3, B3 and C3 in a sheet add up to over 30 I would like to automatically
warn the user with a message box. Is it possible to put the amount these
three cells add up to as well?

If these cells add up to 30 or less then I don't want anything to happen.

Any help would be appreciated. Thank you.

--Elaine