Hi Ken,
A cell's formula is erased once you type in a value.
What you are trying to do can be done using a VBA worksheet Event
Procedure. The procedure runs everytime a cell value on that sheet
changes.
To do what you are wanting, the code in the procedure first checks if
the cell(s) whose value(s) changed are in column C starting at C2. If
Yes then the code continues, if No then the code ends.
If cells in the range C2:C65536 changed then the code turns off, or
disables, Events to avoid looping caused by self-triggering, then each
cell in column C whose value changed has the value of the corresponding
cell in column B added to it. If the column B cell is not a number then
the C cell value remains at what ever value was typed in.
After all the cells have been processed the code then enables Events so
that the Event procedure will be ready to run the next time any cells
change.
The only problem with event procedures is that they are macros and
macros only work if the Security Level allows them to run and then only
if the user clicks the "Enable Macros" button on the "Security Warning"
dialog that appears when the workbook is opened.
If you decide to try out the code below (on a COPY of your workbook of
course) then first change your Security level to Medium by going
Tools|Macro|Security...select Medium|OK|Close|Open the workbook
again|Click the "Enable Macros" button on the "Security Warning"
dialog.
To get the code in place...
1. Copy code below...
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, _
Range("C2:C" & Rows.Count)) Is Nothing Then
With Application
..EnableEvents = False
..ScreenUpdating = False
End With
Dim rngCell As Range
For Each rngCell In Intersect(Target, _
Range("C2:C" & Rows.Count))
On Error Resume Next
rngCell.Value = rngCell.Value + _
rngCell.Offset(0, -1).Value
Next rngCell
Application.EnableEvents = True
End If
End Sub
2. Right click the worksheets sheet tab then select "View Code" from
the popup
3. Paste the code into the worksheet module that appears.
4. Return to Excel by pressing Alt + F11 or going File|Close and Return
to Microsoft Excel.
Ken Johnson