Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Condensing Multiple Worksheets Into One.

Condensing Multiple Worksheets Into One

by Allen Wyatt
(last updated March 28, 2020)


If you get workbooks that have identically structured data on each worksheet, you may be interested in a way to combine the multiple worksheets into a single, large worksheet.

The concept behind doing the condensation is rather easy: You simply need to copy the data from the second and subsequent worksheets to the first empty row on the first worksheet. Excel does not include a tool that allows you to do this automatically, but it is a great candidate for a macro. Remember, though, that the structure of each worksheet you are condensing should be identical.

The following macro steps through all the worksheets and combines the data to a new worksheet that it adds at the beginning of the workbook.

Sub Combine()
    Dim J As Integer
    Dim s As Worksheet

    On Error Resume Next
    Worksheets.Add ' add a sheet in first place
    Sheets(1).Name = "Combined"

    ' copy headings
    Selection.Copy Destination:=Sheets(1).Range("A1")

    For Each s In ActiveWorkbook.Sheets
        If s.Name <> "Combined" Then
            Application.GoTo Sheets(s.Name).[a1]
            ' Don't copy the headings
            Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
            Selection.Copy Destination:=Sheets("Combined"). _
              Cells(Rows.Count, 1).End(xlUp)(2)
        End If
End Sub

When the macro is done, the first sheet in the workbook, named Combined, has all the data from the other worksheets. The other worksheets remain unchanged.


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8884) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Condensing Multiple Worksheets Into One.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Seeing Excel's Program Window

Have you ever opened Excel to find that the window you saw yesterday is not the same as it is today? Sometimes, for ...

Discover More

Restoring the Analysis ToolPak

Add-ins for Excel, such as the Analysis ToolPak, are stored in files on your hard drive that can be deleted. If you ...

Discover More

Deleting Freezes Computer

Sometimes a strange object or text may appear in your document, as happened to Sharon. To complicate the situation, her ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Colors and Fonts for Worksheet Tabs

Changing the color used on a worksheet tab is easy. Just follow the three steps in this tip.

Discover More

Jumping to Alphabetic Worksheets

Got a workbook with a lot of worksheets in it? Here are some handy ways to jump to the worksheet you want, alphabetically.

Discover More

Lotus Grouped Worksheets

Not all spreadsheet programs are created equal; there are some things that can be done in others that can't be done in ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 - 0?

2020-11-27 13:18:22

Peyton Brown

This macro worked really well to combine the worksheets. I was trying to copy the data in the combined worksheet into another workbook but I keep getting the message "The information cannot be pasted because the Copy area and the Paste area are not the same size and shape." I have been trying to paste cell values and only have my cursor in a single cell. Any advice?

Thank you very much for the help!

2020-06-29 10:05:47


Thank you very mich for that makro! Very helpful! Could you maybe help me with one question? My heading contains 5 instead of 1 row. How could I adjust that?

Thank you very much in advance!


2020-04-23 05:12:34

Alan Elston

Hi Andrea
It is a bit different what you want.
It is a very common thing to do, what you want. But giving you a full macro here will look a bit messy in the confines and format limitations of a Comment section. It is a complete new macro you need , not just a few changes to Allen Wyatt's above.
A Google search with like “VBA combining multiple workbooks into one” will flood you with examples.

If you then need further help it would probably be best to ask at a help forum, such as excelforum com or mrexcel com
You will get a quick answer there. If you are not in a rush I would do it for you over at excelfox com when I have time

Alan Elston

2020-04-22 19:49:13


This is exactly what i need except that the source is from different workbooks/files called FC_1, FC_2,FC_3... stored in the same directory.
The sheets is called "Account" for all files and have the same format. please can you help me?

2020-04-21 05:35:03

Alan Elston

Edit should be
Dim Cnt As Long

2020-04-21 04:49:52

Alan Elston

Hello Tina Glynn
The macro from Allen Wyatt is looping for each worksheet by virtual of these two lines
For Each s In ActiveWorkbook.Sheets

s is Dimensioned ( declared ) as a worksheet

You can do it a bit differently in your case:
_ You can ignore the s
_ In VBA you can reference a worksheet by its Item number, which is its Tab number counting from the left.
_ Allen Wyatt’s macro adds a new worksheet at tab number 1, so then your first 3 tabs will shift to the right by one place and will then have the item numbers of 2 3 and 4

An alternative Looping section for you would be something like:

Dim Cnt
For Cnt = 2 to 4
Application.GoTo Worksheets.Item(Cnt).[a1] ' This will go to the second, third and Forth worksheet, Items 2, 3 and 4
' Don't copy the headings
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets("Combined"). _
Cells(Rows.Count, 1).End(xlUp)(2)
Next Cnt

Alan Elston

2020-04-20 15:16:15

Tina Glynn

Can this be used to only combine 3 worksheets and then stop? I have a workbook with 15 sheets, but I only want this to work for the first 3 sheets.

2020-04-20 12:54:31


I understood, thank you, gentlemen, for your time!

2020-04-18 05:04:38

Alan Elston

Hi Peter…….The full syntax of what Allen Wyatt is using is like …….Cells(Rows.Count, 1).End(xlUp).Item(2) ……..….Item(2) will give us the cell just below the cell given by…….Cells(Rows.Count, 1).End(xlUp) ………….Cells(Rows.Count, 1).End(xlUp) is the same as …….Cells(Rows.Count, 1).End(xlUp).Item(1) ……………….It is not to easy to explain how the items are assigned for a range……See the demo that I have done for you here:…….…. ----- ----- ….As you will see, item numbers are not restricted to the range given. They keep going. …Cells(Rows.Count, 1).End(xlUp) returns just one cell…..But item(2) is the cell beneath…. Item(3) is two cells beneath ….etc…. ……As you will see, Item numbers are not restricted to just the range itself. The item numbers keep going. They go in a sequence of ... all columns in a row, ... then the next row ... etc........... The column count is determined by the original range, but the rows are not limited.…………Alan Elston

2020-04-18 04:49:12

Peter Atherton

If Cells(Rows.Count, 1).End(xlUp).Row gives the last row number then Cells(Rows.Count, 1).End(xlUp)(2) gives an offset of 1 row. You can test this in some data with the line Cells(Rows.Count, 6).End(xlUp)(2).Select

2020-04-17 16:24:14


Thank you, I come here ofter for the useful information. Can you please tell what digit "(2)" means in the end of

Selection.Copy Destination:=Sheets("Combined"). _
Cells(Rows.Count, 1).End(xlUp)(2)

I can't figure out..


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.