Thread: Update totals
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Update totals

Right click on the sheet tab and select view code. Put is code similar to
this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo ErrHandler
If Target.Count = 1 Then
If Not Intersect(Target, Range("B2:F32")) Is Nothing Then
If IsNumeric(Target) Then
dblVal = Target.Value
Application.EnableEvents = False
Application.Undo
Target.Value = Target.Value + dblVal
End If
End If
End If

ErrHandler:
Application.EnableEvents = True
End Sub

they would need to enter a negative number to correct mistakes.

--
Regards,
Tom Ogilvy



Gareth wrote in message
...
I have a sheet which contains data about certain parts of our office. The
data is in range B2:F32.

The data is numeric.

What I would like to do, if possible, is the following:

B2 contains 94, the user wants to add 37 to it by typing 37 over the 94,

hit
return and the new total of 131 should appear.

Many thanks in advance.

Cheryl