+ Reply to Thread
Results 1 to 2 of 2

paste a forumla and copy with a macro

  1. #1
    Chris_t_2k5
    Guest

    paste a forumla and copy with a macro

    Here is my problem. I have data in columns A:C however the number of rows
    will differ each time.

    I need a macro that will paste a preset formula eg. (=sum(A1:C1)) into cell
    D1 and drag it down to the last cell which contains data in the previous
    columns?

    Thanks in advance

  2. #2
    Tom Ogilvy
    Guest

    Re: paste a forumla and copy with a macro

    Sub addFormulas()
    Dim rng as Range
    With worksheets("Sheet1")
    set rng = .Range(.Cells(1,3),.Cells(rows.count,3).End(xlup))
    End With
    rng.offset(0,1).Formula = "=Sum(A1:C1)"
    End Sub

    --
    Regards,
    Tom Ogilvy



    "Chris_t_2k5" <Christ2k5@discussions.microsoft.com> wrote in message
    news:610CA6D2-146C-440A-9FB4-752C94CD94AD@microsoft.com...
    > Here is my problem. I have data in columns A:C however the number of rows
    > will differ each time.
    >
    > I need a macro that will paste a preset formula eg. (=sum(A1:C1)) into

    cell
    > D1 and drag it down to the last cell which contains data in the previous
    > columns?
    >
    > Thanks in advance




+ 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