Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Change Event Tony S.[_2_] Excel Discussion (Misc queries) 11 February 18th 09 01:04 AM
Worksheet Change event DoctorG Excel Discussion (Misc queries) 4 February 15th 06 12:53 PM
Worksheet Change Event DCSwearingen Excel Discussion (Misc queries) 1 October 10th 05 10:25 PM
help with worksheet change event Mike NG Excel Programming 4 September 15th 03 11:46 PM
Worksheet Change Event Help Please J P Singh Excel Programming 1 July 16th 03 09:37 AM


All times are GMT +1. The time now is 07:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"