+ Reply to Thread
Results 1 to 2 of 2

Copy and paste formulas macro help

  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.

    Please Login or Register  to view this content.
    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.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Copy and paste formulas macro help

    Hi Josh, thanks for changing the thread title. If you want to copy the formulas from row 2 (AS2:EJ2) into the next row down from the activecell, then this should work:
    Please Login or Register  to view this content.
    Your original code was setting r1 to a range that probably wasn't being used. If the activecell's row was 8, the line
    Please Login or Register  to view this content.
    would set r1 to "Range("AS28:EJ28"). It is simply combining the n value with the strings.

+ Reply to Thread

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