February 11, 2015
Hello
Good afternoon.
I would love some help writing a macro that does the following:
Copy’s all worksheets into one “Summary Tab”, with the exception of the Drop List tab. I will be adding new tabs each week, so I will have re-run this macro weekly as well. I would like for it to replace the old information.
All the headers are the same, so I only need the header columns listed once at the top of the list.
Any help would be greatly appreciated.
Thanks
Amy
VIP
Trusted Members
June 25, 2016
Hi Amy
Give this a try.
Please note that for any additional sheet to be added and merged, the sheet's name must contain the text "Scrap Report"
The macro will search thru all sheets and will only merge those sheet names containing the text "Scrap Report".
The macro will clear the Summary Tab data (excluding the header) before merging.
Hope this helps.
Sunny
February 11, 2015
Sunny
Wow! Thank you so much. This is awesome. This will save me so much time.
I have a question on the formula?
With this, does this mean something has to be in column B for it to pull over onto the summary tab?
Find the last row with data
LastSrc = ws.Cells(Rows.Count, "B").End(xlUp).Row 'Weekly sheet
Also, can you explain this code as well? What does the “A” do?
CopyRng.Copy
With DestSh.Cells(LastTgt + 1, "A")
I’m trying to learn VBA, put it’s a struggle.
Thank you again for taking the time to help me with this.
Sincerely
Amy
VIP
Trusted Members
June 25, 2016
Hi Amy
Glad you like the macro.
The code LastSrc = ws.Cells(Rows.Count, "B").End(xlUp).Row search for the last row with data in column B.
You can use any column of your choice but make sure that it does not have any blanks.
I did not choose column A in your example as I noticed that in your Scrap Report Week 1 sheet, my macro would have given me 3 as the last row instead of 4 due to the blank in cell A4.
In the code With DestSh.Cells(LastTgt + 1, "A") , A is the column as the syntax is CELLS(row,column). Both row and column can be a number but column can also be an alphabet like this case.
The code If LastSrc >= StartTgt checks to see if the last row is the same or more than the start row which I set to 3 in your example.
If it is more than or equal to 3 then it must contain data and the data will be copied, else that sheet will be ignored.
Hope this explanation is clear enough.
Sunny
February 11, 2015
Sunny
Thanks again. I have one more thing I would like to add to the macro, if possible? On the Summary Tab, is there a way to highlight the cell in the RGA # column (K) if the cell is blank, but only if the Disposition column (J) is Vendor Credit / Return. This way I know I have to get a RGA from the customer.
Thanks so much
Amy
VIP
Trusted Members
June 25, 2016
1 Guest(s)