+ Reply to Thread
Results 1 to 3 of 3

Use VBA to add to existing number in cell

  1. #1
    Registered User
    Join Date
    09-29-2004
    Posts
    39

    Use VBA to add to existing number in cell

    I am using a userform to select the data I need in certain cells. However, if there is existing information I want to add the following and not overwrite.

    Range("C14").Select
    ActiveCell.FormulaR1C1 = _
    "=Sheet1!R[-2]C[6]+Sheet2!R[5]C[2]+Sheet3!R[58]C[24]"

    Could anyone help,
    Thanks
    Hywel

  2. #2
    Dave O
    Guest

    Re: Use VBA to add to existing number in cell

    This type of code can lead to a problem: if you take the value of the
    cell and add those three other cells, what's to prevent you from
    accidentally doing it again, thereby skewing your data?


  3. #3
    JE McGimpsey
    Guest

    Re: Use VBA to add to existing number in cell

    One way:

    With Range("C14")
    .FormulaR1C1 = "=" & IIf(IsEmpty(.Value), "", .Value & "+") & _
    "Sheet1!R[-2]C[6]+Sheet2!R[5]C[2]+Sheet3!R[58]C[24]"
    End With





    In article <[email protected]>,
    Hywel <[email protected]> wrote:

    > I am using a userform to select the data I need in certain cells.
    > However, if there is existing information I want to add the following
    > and not overwrite.
    >
    > Range("C14").Select
    > ActiveCell.FormulaR1C1 = _
    > "=Sheet1!R[-2]C[6]+Sheet2!R[5]C[2]+Sheet3!R[58]C[24]"
    >
    > Could anyone help,
    > Thanks
    > Hywel


+ 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