+ Reply to Thread
Results 1 to 8 of 8

macro that puts a formula in a group of cells then goes and values those cells

  1. #1
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    269

    macro that puts a formula in a group of cells then goes and values those cells

    Hi, this has been a big mess for me to try to macro record in the file I am working in. What I am trying to do is tell excel to copy a bunch of lines down into another section and then value that section so it does not change.
    Every month we need to look at variances for our numbers, I want to push a button once a month so it takes what I had last month and pushes it down to prior before I build current. Then a subtraction formula shows my variances.

    A picture is worth a thousand words so I included this file...
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    Using a command button from the Control Toolbox you could use the following.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    this sub will look for all rows containing current and copy the row to the table starting in cell 28 in your case. But you could put the table where ever you want.

    Hope thats what you want:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    269
    Wow, that is really slick Reafidy, really slick. I got it to work in my file, but can I please have a little more help?

    I added a bit of a twist. The file I am using has a big gap in the middle between 2008 and 2009, where other formulas, operations and inputs are that I don't want copied below. Is there a way to write this code so it skips the middle? Also the file I am working on has several sheets, but only 7 need this macro, and all 7 have pretty much the same format, is there an easy way to make it so when I push my button it does all 7 sheets with one click.

    You rock in every way thanks for your help!!!

  5. #5
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    269
    Oops, it did not add my file...
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    assuming your tables are in line:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    269
    Man, that is awesome, I think I can make it work for my file, some of the sheets are exact matches, all have the same row setup, but there are a few that have extra columns here and there. For the sheets that are identical would I use

    Please Login or Register  to view this content.

    After Next i start another vWshts like below...
    Please Login or Register  to view this content.

    run it agian past
    Please Login or Register  to view this content.

    and then do it again for another unique sheet with...

    vWShts = Array("Unique Sheet 2")

    Is that the correct method?

    Thanks again!!!!!
    Last edited by VBA Noob; 10-31-2007 at 03:15 AM.

  8. #8
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    yes that could work but this might be easier:

    Please Login or Register  to view this content.

+ 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