+ Reply to Thread
Results 1 to 7 of 7

Copy an equation down to the last row.

  1. #1
    Registered User
    Join Date
    06-30-2011
    Location
    Stuttgart, Germany
    MS-Off Ver
    Excel 2010
    Posts
    26

    Copy an equation down to the last row.

    Hello,

    I run a macro to import data from another file. Everytime the data is imported, the number of data rows changes. The data goes from column A to column Y. In column Z I have an equation. This equation should be copied down for all the rows. Meaning if the last row is row 208, the equation should be copied down to row 208. Then next time before the data is imported, the column should be cleared (except for the first row--so that I have the equation in a cell) and then copied down to the last row again, which might be row 104 or 350...etc. (Meaning if the data rows decrease, the equation should not go past the data rows).

    How can I do this?

    Thank you in advance for your help!

    Sincerely,

    az!
    Last edited by az!; 03-11-2013 at 04:54 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copy an equation down to the last row.

    Assuming the formula exists in Z2, then like so:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Copy an equation down to the last row.

    Just a question...

    If you are copying the same formula down each time you import your data, why do you need to clear (delete?) the formula in the 1st place? I would think it would be far simpler to copy the formula down to way past where you think you would need them, and then just leave the formulas there, and modify them so that they show nothing if there is nothing in that row (ie, if the data does not reach down that far)?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    06-30-2011
    Location
    Stuttgart, Germany
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Copy an equation down to the last row.

    JBeaucaire: Thank you, I will try this.
    FDibbins: Ok, if the equation won't show up, that would be fine. I just don't want a lot of error messages. How would I do this?

    Thank you both for the help!

    ~az!

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Copy an equation down to the last row.

    pick a cell within the row - lets call it A2 (Im assuming that only row 1 will contain headings, if not, adjust the formula accordingly). then use something like this....

    =if(A2="","",your-formula-here)
    copied down

  6. #6
    Registered User
    Join Date
    06-30-2011
    Location
    Stuttgart, Germany
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Copy an equation down to the last row.

    Super! Thank you!

    ~az!

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Copy an equation down to the last row.

    happy to help

+ 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