zookeepertx
Well-known Member
- Joined
- May 27, 2011
- Messages
- 591
- Office Version
- 365
- Platform
- Windows
I got GREAT macro assistance here a month or so ago from KPark & it’s working terrific! (Saved me about a day and a half last week on month-end work.) I’m wondering if someone can tell me how to add one more thing to it, that I forgot about before.
This is for a report comparing the previous month’s data with this month’s data. Both sides get shored up so that they end up with the same number of rows, by inserting a row on one side if there’s not already one to match that row on the other side. What the macro does is to create 2 new, temporary worksheets, then put all of the previous month’s data on the first one (newWS1) & all of this month’s data on the second one(newWS2). Then it loops through, comparing the 2 sheets & when it finds that one of them has a row with no match on the other, it inserts a new row that is blank except for the file # and the dept #. After it gets both sheets even, it creates another new worksheet (balWS), copies all the header rows from the original sheet to the balWS and copies the information from newWS1 to balWS below the headers, starting in column A and from newWS2 to balWS starting in column R. Then it deletes the 2 temporary worksheets.
What I’d like to have happen next is to copy the last several rows from the original worksheet (containing formulas totaling the columns, along with some other information) & paste it below the data on the balWS. My problem is that all of this data varies in length from one month to the next, so I never know what row# the totals are going to be on or what row# they need to be pasted on. How do I tell it to copy the rows that start after the end of the original data & how do I tell it to paste those rows after the end of the balWS data, however long each of those worksheets are? Also, the Total formulas need to change to include all rows in their column from row 7 to the last row.
Sorry if I’ve been really confusing; I’m notorious for that, LOL! Thanks in advance for any help!
This is for a report comparing the previous month’s data with this month’s data. Both sides get shored up so that they end up with the same number of rows, by inserting a row on one side if there’s not already one to match that row on the other side. What the macro does is to create 2 new, temporary worksheets, then put all of the previous month’s data on the first one (newWS1) & all of this month’s data on the second one(newWS2). Then it loops through, comparing the 2 sheets & when it finds that one of them has a row with no match on the other, it inserts a new row that is blank except for the file # and the dept #. After it gets both sheets even, it creates another new worksheet (balWS), copies all the header rows from the original sheet to the balWS and copies the information from newWS1 to balWS below the headers, starting in column A and from newWS2 to balWS starting in column R. Then it deletes the 2 temporary worksheets.
What I’d like to have happen next is to copy the last several rows from the original worksheet (containing formulas totaling the columns, along with some other information) & paste it below the data on the balWS. My problem is that all of this data varies in length from one month to the next, so I never know what row# the totals are going to be on or what row# they need to be pasted on. How do I tell it to copy the rows that start after the end of the original data & how do I tell it to paste those rows after the end of the balWS data, however long each of those worksheets are? Also, the Total formulas need to change to include all rows in their column from row 7 to the last row.
Sorry if I’ve been really confusing; I’m notorious for that, LOL! Thanks in advance for any help!