+ Reply to Thread
Results 1 to 3 of 3

Is there a way to consolidate 30 spreadsheets into one for data entry?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-11-2010
    Location
    US
    MS-Off Ver
    NA
    Posts
    41

    Is there a way to consolidate 30 spreadsheets into one for data entry?

    For example, lets say you are working on 3 files with 14, 20, and 21 lines. These ranges are consistently being increased with new activity. Let say, they each received 4 new rows of data.

    How can you consolidate them without having blanks rows.

    Thanks

  2. #2
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: Is there a way to consolidate 30 spreadsheets into one for data entry?

    Definitely a place for a macro.

    In my example there is a theoretical max of 50 rows (which was easier to record than with something like 500 rows) in each of the three lines but you can see in the code where to modify when needed.

    So Sheet1 is the master sheet to collect the data and Sheets from 2 to 4 are the information sheets. Information (with blanks in the end) is A1:A50 in every sheet and it's consolidated manually (not with Excel Consolidate feature). I believe the code makes things pretty clear:

    Sub Macro1()
        Sheets("Sheet2").Select
        Range("A1:A50").Select
        Selection.Copy
        Sheets("Sheet1").Select
        Range("A1").Select
        ActiveSheet.Paste
        Sheets("Sheet3").Select
        Range("A1:A50").Select
        Selection.Copy
        Sheets("Sheet1").Select
        Range("A51").Select
        ActiveSheet.Paste
        Sheets("Sheet4").Select
        Range("A1:A50").Select
        Selection.Copy
        Sheets("Sheet1").Select
        Range("A101").Select
        ActiveSheet.Paste
        Range("A1:A150").Select
        Range("A150").Activate
        Selection.SpecialCells(xlCellTypeBlanks).Select
        Application.CutCopyMode = False
        Selection.EntireRow.Delete
        Range("A1").Select
    End Sub

    Indeed I recorded the macro but not wrote it so there might be pointless lines. Shouldn't be though.

    Again: this needs to be expanded from 3 to 30 sheets and the data ranges might need a slight modification.

    ---
    Edit: Amazed by code below
    Last edited by KiPA; 11-24-2010 at 06:44 AM.
    An example file is never useless!

    Tried an example function of mine and got errors?
    - Had you found them, replace ; with , and , with .

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Is there a way to consolidate 30 spreadsheets into one for data entry?

    To collate every sheet except sheet1 (which is the summary itself), try this:
    Option Explicit
    
    Sub Consolidate()
    Dim ws As Worksheet
    Dim Summary As Worksheet
    
    Set Summary = Sheets("Sheet1")
    Summary.Cells.Clear
    
    For Each ws In Worksheets
        If ws.Name <> Summary.Name Then _
            ws.Range("A1", ws.Range("A" & Rows.Count).End(xlUp)).Copy _
                Summary.Range("A" & Rows.Count).End(xlUp).Offset(1)
    Next ws
    
    Summary.Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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