MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Newbie Help

Posted by noise on August 30, 2000 7:00 AM

I need to input an amount in "Cell-3" then,
if there is an amount in "Cell-2" minus "Cell-2" from "Cell-3" and put the result into "Cell-2" and add it to "Cell-1" then,
Set "Cell-3" to 0

please help, i'm stuck :(

Gavin Davidson

Posted by Celia on August 30, 0100 8:39 PM


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Dim keyCell As Range
Set keyCell = Range("A3")
If Not Application.Intersect _
(keyCell, Range(Target.Address)) Is Nothing Then
With Target
If .Offset(-1, 0) <> "" Then
.Offset(-1, 0) = .Value - .Offset(-1, 0).Value
.Offset(-2, 0) = .Offset(-2, 0).Value + .Offset(-1, 0).Value
.Value = 0
End If
End With
End If
Application.EnableEvents = True
End Sub