additional addition oops


Posted by MARK HOLMS on October 28, 2001 1:39 AM

I wish to add up or even multiply a varying number of figures in the same cell. It would be O.K. if the result appeared in the next adjacent cell to avoid circular reference. I know you can do this 'manually' by sticking in an equals sign and then say 20.12+ 45.78 and excel will add them up (and even put the answer in the same cell). But what I want is a formula for that cell, so I don't have to put in the equals sign 'manually' each time. Thanks folks



Posted by Peter Beardsley on October 28, 2001 3:07 AM


If you want to add an equal sign to the cell containing the data :-
Sub Add_EqualSign()
Dim cell As Range
For Each cell In Selection
cell.Formula = "=" & cell.Value
Next
End Sub

If you want it in the cell to the right :-
Sub Put_in_NextCell()
Dim cell As Range
For Each cell In Selection
cell.Offset(0, 1).Formula = "=" & cell.Value
Next
End Sub