Re: Add forumla

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



No you need VBA

Option Explicit

Private prev

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Value = .Value + prev
prev = .Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
prev = Target.Value
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.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Ross" <Ross@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:48037C23-5FD9-4795-8384-5EB9A844F70A@xxxxxxxxxxxxxxxx

Hi,

Does anyone know of a formula, or similar, that can be used which would
allow the user to simply type in the number to be added into the cell say
"2"
and it will add this number onto the number previously in the cell
(assume"3") giving a new total of "5".

Thanks,
R


.



Relevant Pages

  • Re: Date Filling for Prior Year
    ... Option Explicit ... Private Sub Worksheet_Change(ByVal Target As Range) ... Dim rg As Range ...
    (microsoft.public.excel)
  • Re: Clean-Up Cascading Data Validation List Values
    ... Option Explicit ... Private Sub worksheet_change(ByVal target As Range) ... The first list (in cell A1) ...
    (microsoft.public.excel.misc)
  • Re: Date Stamp in one cell when data in other range changes
    ... Option Explicit ... Private Sub Worksheet_Change(ByVal Target As Excel.Range) ... If .Count> 1 Then Exit Sub ...
    (microsoft.public.excel.programming)
  • Re: Warn if data is in range
    ... Option Explicit ... Private Sub Worksheet_Change(ByVal Target As Range) ... 'This is worksheet event code, which means that it needs to be ...
    (microsoft.public.excel.worksheet.functions)
  • Re: BUTTONS
    ... Option Explicit ... Private Sub Worksheet_Change(ByVal Target As Range) ... Change Target Address ...
    (microsoft.public.excel.programming)