Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Consolidating Data from Multiple Tables on Multiple WorkSheets

Posted on 2013-10-31
2
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Flyster earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

715 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