Consulting

Results 1 to 5 of 5

Thread: Solved: Accumulate the values

  1. #1
    VBAX Mentor
    Joined
    Sep 2007
    Posts
    405
    Location

    Solved: Accumulate the values

    Hello...
    I have a doubt.. this might be simple but still…

    I have a column A and a column B with Sum of values of Column A.
    If enter value in column A the value should add up to the existing value in column B

    A B
    10 256330


    If I change to 20 then B value should be 256330+20
    Like this I need to accumulate the values everyday…

    any help on this please..

    -Sindhuja

  2. #2
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location
    [VBA]Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Intersect(Target, Cells(1, 1)) Is Nothing Then Exit Sub
    Cells(1, 2) = Cells(1, 2) + Cells(1, 1)
    End Sub
    [/vba]

  3. #3
    VBAX Mentor
    Joined
    Sep 2007
    Posts
    405
    Location
    Thank you so much for the response... its specific for a single cell..
    if that is to applicable to the whole column then where should i change...

    -Sindhuja

  4. #4
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location
    If there is a specific cell in column B that always takes the value from column A:[vba]Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Intersect(Target, Columns("A")) Is Nothing Then Exit Sub
    Cells(1, 2) = Cells(1, 2) + Target
    End Sub
    [/vba]If you want the cell in column B in the same row as the cell in column A to be added to:[vba]Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Intersect(Target, Columns("A")) Is Nothing Then Exit Sub
    Target.Offset(, 1) = Target.Offset(, 1) + Target
    End Sub
    [/vba]

  5. #5
    VBAX Mentor
    Joined
    Sep 2007
    Posts
    405
    Location
    Works perfectly Nate….
    Thanks a lot…..

    - Sindhuja

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •