Solved

# Excel - Combining Worksheets

Posted on 2011-02-11
297 Views
Hi,

I have an Excel workbook with 12 worksheets.

Other than copy/paste, is there a method to combine the rows of all 12 worksheets into one worksheet  - 13. All sheets have the same cells in the header row.

Thank you
0
Question by:tahirih
• 3
• 2

LVL 59

Expert Comment

You can do it by use of macro..Help me understand does in your worksheet you have 13 sheets only..? or there are more worksheets?

Also what is the 13th sheet callled where you want to move the data to?

I also assume that all your 12 worksheets have same amount of data..as in column headings...
0

Author Comment

There are more worksheets - I want to combine the first 12 (or 'n' for that matter).

The 12 (n) worksheets do not have the same amount of data (they vary in the number of rows filled)

Thanks
0

LVL 59

Expert Comment

What's the worksheet name as in by what name you call them which you want to combine..?? And what is the worksheet 13 called..?
0

Author Comment

They have varying names - not a consistent naming system (e.g. 1 - 12)

Thank you
0

LVL 59

Accepted Solution

Saurabh Singh Teotia earned 500 total points

You can use the following code and i have assumed all your worksheets i.e 1-12 are in order..This will do what you are looking for...

Saurabh...
``````Sub movemydata()
Dim ws As Worksheet
Dim lr As Long, cl As Long
Dim lrw As Long
Dim k As Long
Dim ws1 As Worksheet
Set ws = Sheets("13")

Application.ScreenUpdating = False

Sheets("1").Select

For k = 1 To 11
cl = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
lr = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
On Error Resume Next
If Err.Number = 91 Then lrw = 1
Err.Clear
lrw = ws.Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
Range("A1:" & Cells(lr, cl).Address).Copy ws.Range("A" & lrw + 1)

ActiveSheet.Next.Select
Next k

Application.ScreenUpdating = True
End Sub
``````
0

## Featured Post

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.