+ Reply to Thread
Results 1 to 3 of 3

adding ranges

  1. #1

    adding ranges

    how do i make a button that adds
    two ranges together
    i.e
    adds a1 to c1, a2 to c2 etc..
    and places these values in the "a" column where the previous values were
    thanks for the help

  2. #2
    Tom Ogilvy
    Guest

    Re: adding ranges

    Sub AddValues()
    Dim cell as Range
    if Selection.Columns.count > 1 then exit sub
    if selection.Column <> 1 then exit sub
    for each cell in selection
    if isnumeric(cell.value) and isnumeric(cell.offset(0,2).Value) then
    cell.Value = cell.Value + offset(0,2).Cell.Value
    end if
    Next
    End Sub

    select the cells in column A that you want to update and run the macro. You
    can also manually select the column of contiguous cells in column C, then do
    Edit=>Copy, then select the first cell in column A and do Edit=>Paste
    Special and select Values and Add.

    --
    Regards,
    Tom Ogilvy

    "[email protected]" <[email protected]> wrote in message
    news:[email protected]...
    > how do i make a button that adds
    > two ranges together
    > i.e
    > adds a1 to c1, a2 to c2 etc..
    > and places these values in the "a" column where the previous values were
    > thanks for the help




  3. #3
    Chip Pearson
    Guest

    Re: adding ranges

    Use code like the following:

    Dim Rng As Range
    For Each Rng In Range("A1:A10")
    Rng.Value = Rng.Value + Rng(1, 3).Value
    Next Rng

    Change the A1:A10 to the appropriate range.

    I



    "[email protected]" <[email protected]> wrote
    in message
    news:[email protected]...
    > how do i make a button that adds
    > two ranges together
    > i.e
    > adds a1 to c1, a2 to c2 etc..
    > and places these values in the "a" column where the previous
    > values were
    > thanks for the help




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1