Solved

Consolidating Data from Multiple Tables on Multiple WorkSheets

Posted on 2013-10-31
2
155 Views
Last Modified: 2013-11-13
I have several worksheets with data tables that I would like to consolidate on a single worksheet for evaluation.
All data tables are cells B5:U1004 on each worksheet but not all rows have data.
I need a macro that selects all the rows in the table up to the last row in the table that has data and copy it.  Then paste it into the first empty row in the worksheet in which I will be consolidating all the data tables...and do this for each worksheet that has that table.

I've attached a sample workbook with smaller data tables and the last worksheet is the final results I'm looking for.

Thanks,

Edwin
Data-Table-Test-Book.xlsm
0
Comment
Question by:gixxer1020
2 Comments
 
LVL 22

Accepted Solution

by:
Flyster earned 500 total points
ID: 39616000
Give this macro a try:
Sub CopySheets()
Dim LrRet, LrDs, LrMot, LrCd1, LrCd2 As Long

Sheets("RET").Select
  LrRet = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range("B6:P" & LrRet).Select
      Selection.Copy
    Sheets("Consolidated Data").Select
  Range("B6").Select
ActiveSheet.Paste
Sheets("DS").Select
  LrDs = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range("B6:P" & LrDs).Select
      Application.CutCopyMode = False
        Selection.Copy
      Sheets("Consolidated Data").Select
    LrCd1 = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
  Range("B" & LrCd1).Select
ActiveSheet.Paste
Sheets("MOT").Select
  LrMot = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Range("B6:P" & LrMot).Select
      Application.CutCopyMode = False
        Selection.Copy
      Sheets("Consolidated Data").Select
    LrCd2 = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
  Range("B" & LrCd2).Select
ActiveSheet.Paste

End Sub

Open in new window

Flyster
0
 

Author Closing Comment

by:gixxer1020
ID: 39647039
Works like a charm, thanks Flyster
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now