+ Reply to Thread
Results 1 to 6 of 6

Macro to copy formulas down based on row count from another sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    12-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2

    Macro to copy formulas down based on row count from another sheet

    Hello,

    I need to tweek a spreadsheet so that I can hand it off to someone who is a little less experienced in excel. One of the enhancements that I would like to do is create a macro to copy a row of formulas down instead of having to copy the same formula down. The formulas are on Sheet 1 and they are linking to a pivot chart on tab called MMS pivot. The rowcount on MMS Pivot is variable. I need a macro that will look at the number of rows on MMS Pivot tab and copy the formula down (on sheet 1) the appropriate number of rows. The MMS Pivot table has columns A:U & sheet 1 has formulas from column A:AC

    Again, I'm very new to VBA so everything still looks like Greek to me. I'll try to not ask too many dumb questions.

    Thanks! Kevin
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    04-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    198

    Re: Macro to copy formulas down based on row count from another sheet

    
    Dim lastrow As Long
    Sheets("MMS Pivot").Select
    lastrow = Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Row
    ' That will give you the lastrow on whatever sheet is selected...
    Sheets("Sheet1").Select
    Range("A3:AC" & lastrow).FillDown
    Last edited by cory0789; 12-07-2014 at 10:41 PM.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,719

    Re: Macro to copy formulas down based on row count from another sheet

    No Selecting needed
    Sub Maybe()
    Range("A3:AC" & Sheets("MMS Pivot").Cells(Rows.Count, 1).End(xlUp)).FillDown
    End Sub

  4. #4
    Forum Contributor
    Join Date
    04-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    198

    Re: Macro to copy formulas down based on row count from another sheet

    Yes it is.... The fornulas are not on the pivot tab...

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,719

    Re: Macro to copy formulas down based on row count from another sheet

    Sub Maybe()
    Range("A3:AC" & Sheets("MMS Pivot").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row).FillDown
    End Sub

  6. #6
    Registered User
    Join Date
    12-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2

    Re: Macro to copy formulas down based on row count from another sheet

    Thank you for the help....this solved my issue

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to Copy Data from one Sheet A to Sheet B based on value in cell on sheet A
    By scass in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2012, 07:21 PM
  2. [SOLVED] Macro to copy formulas down based on row count from another sheet
    By kduschel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2012, 06:51 AM
  3. [SOLVED] Macro: Dynamic creation of sheet based on cell value then copy range to the new sheet
    By BeachRock in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-15-2012, 11:31 AM
  4. Need Macro to search from mater sheet and copy in another sheet based on Criteria
    By humacdeep in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-29-2012, 01:03 PM
  5. Macro: Count rows in sheet A, copy count in sheet B, paste offset in sheet A
    By Agent:Orange in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-19-2011, 07:56 AM

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