Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet change event
Open the VB editor, and in the Project Explorer, select
the sheet with the calculations. In the Code Window, paste this code: Private Sub Worksheet_Change(ByVal Target As Range) Dim AddUp As Double Dim TheRange As Range Set TheRange = Worksheets("Sheet1").Range("A1:F1") AddUp = Application.WorksheetFunction.Sum(TheRange) If AddUp < Range("C8").Value Then Range("C9").Value = "Wrong" Else Range("C9").Value = "" End If End Sub Change the worksheet name and range as needed. This just puts a message on the sheet, which is less annoying than a message box popping up continually. If you do want to catch their attention with a message box, change the if statement to: If AddUp < Range("C8").Value Then MsgBox "The value in C8 should be " & AddUp End If HTH Helen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet Change Event | Excel Discussion (Misc queries) | |||
Worksheet Change event | Excel Discussion (Misc queries) | |||
Worksheet Change Event | Excel Discussion (Misc queries) | |||
help with worksheet change event | Excel Programming | |||
Worksheet Change Event Help Please | Excel Programming |