Multiple Tabs into One

jsimps76

New Member
Joined
Dec 16, 2013
Messages
1
I have a massive amount of data in an excel spreadsheet that spans about 500 different tabs. How can I consolidate those into one single tab without the copy paste function which would take an entire working day for me?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
The below will do what you need:

Code:
Option Explicit

Sub CopyOverSheetData()

Dim ws As Worksheet
Dim wsCopy As Worksheet
Dim rngUsed As Range
Dim rngPaste As Range

'The activesheet is the sheet where data will be pasted!
Set wsCopy = ActiveSheet
Set rngPaste = wsCopy.Range("A1")

'Disable screenupdating and set calculation to manual mode
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

For Each ws In ThisWorkbook.Worksheets
    
    If ws.Name <> wsCopy.Name Then
    
        Set rngUsed = ws.UsedRange
        
        'Copy and paste data
        rngUsed.Copy
        rngPaste.PasteSpecial (xlPasteAll) 'Change parameter to "xlPasteValuesAndNumberFormats" if you only want values
        Application.CutCopyMode = False
        
        'Offset paste range ready for next sheet
        Set rngPaste = rngPaste.Offset(rngUsed.Rows.Count)
    
    End If
    
Next ws

'Reset screenupdating and calculation mode
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

MsgBox "Done!"

End Sub

Hope this helps.
 
Upvote 0
Brett,

Thanks for this, just saved me an age.

However, how could I define the copy range for each tab to start on say row 11. (So that the code will only copy row 11 down into the new page).

ws.UsedRange always selectes the entire page.

Apologies for dragging an old thread up...

Regards
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top