Doing Sums on existing numbers

H

htan1

Hi all,
I want to try and do something on excel but cannot do it. I have numbers on
Cell C1-C10. If I were to key in a number at D1, C1-C10 will reflect number
of whatever number on the cell itself plus the number on D1. That means
Number on C1 will reflect the number equavilent to the sum of the existing
number on C1 and number on D1. And Number on C2 will reflect the the number
equavilent to the sum of the existing number on C2 and number on D1. And so
on until C10.

Really appreciate if you all can help me. Thanks a zillion.
 
B

Biff

Hi!

Try this:

Suppose you want to add 10 to each cell in the range C1:C10.

Enter 10 in D1.
Select cell D1
Copy cell D1
Select the range C1:C10
Paste Special>Add>OK

Biff
 
H

htan1

That does work but I will need it in a more automated way.....is there
anyway I can do it via formula so that I do not have to do a
paste.....because the data involve is in thousands and around different cell
locations thus I cannot go around copy and paste all the time. Thanks a
zillion
 
B

Bob Phillips

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address(False, False) = "D1" Then
With Target
If IsNumeric(.Value) Then
For Each cell In Range("C1").Resize(Cells(Rows.Count,
"C").End(xlUp).Row)
cell.Value = cell.Value + .Value
Next cell
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
 
Top