Results 1 to 2 of 2

Copy and paste formulas macro help

Threaded View

  1. #1
    Registered User
    Join Date
    06-18-2012
    Location
    Mountain View, CA
    MS-Off Ver
    Excel 2007
    Posts
    9

    Copy and paste formulas macro help

    I'm a noobie and am having trouble understanding what is going on with this macro.

    Sub CopyMultidayTimeIntervalFormula()
    
    n = ActiveCell.Row
    Set r1 = Range("AS2" & n & ":EJ2" & n)
    Set r2 = Range("AS" & n + 1)
    r1.Copy
    r2.PasteSpecial Paste:=xlPasteFormulas
       
    End Sub
    I am trying to do the following:
    - Copy the formula I have in the range AS2:EJ2 and paste it into any other rows that meet my criteria.

    When I run this macro it doesn't do anything except highlight the cells in the row below my active cell, which I believe comes from the Set r2 = Range("AS" & n + 1). Can VBA copy a formula and then paste it, or do you have to write the formula to it run?

    Any help or pointers?

    Example Workbook.xlsm
    Last edited by josh.metherd; 06-19-2012 at 05:35 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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