Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Macro to merge worksheets

Within a single workbook, I have 12 worksheets called, say,
"Worksheet A", "Worksheet B",..... through to "Worksheet
L", (being departments for example) which contain common data tables
and alike data. In each worksheet, row 1 is a standard set of column
headers and this is common across all 12 worksheets. A worksheet may be
completely blank/empty, however, should there be no data for that
particular department.

I need to merge all of these worksheets into a single worksheet within
the same workbook called, say, "Consolidated worksheet" which has
the single header row and all of the data in a single combined table.
Is there a macro that will do this automatically for me?

Thanks for help/suggestions.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to merge worksheets

Sorry, this isn't exactly what you want, but it is a step in the right
direction.

Sub CombineSheets()
Dim PasteRange As Range
Dim i As Long
Application.ScreenUpdating = False
Set PasteRange = Worksheets(1).Range("a65536") _
.End(xlUp).Offset(1, 0)
For i = 2 To Worksheets.Count
Worksheets(i).UsedRange.Copy PasteRange
Set PasteRange = Worksheets(1).Range("a65536") _
.End(xlUp).Offset(1, 0)
Next i
End Sub



This code will combine all pages into one page. I would create the tab
you want the data to be on, and run this macro from that tab. Problem
is, this will copy everything, including header rows. You can then
sort once the tabs are combined, and then delete the duplicate header
rows. Hope this helps!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to merge / combine several worksheets into one new worksheet without VBA / Macro? FOR EXPERTS [email protected] Excel Worksheet Functions 9 August 13th 07 04:19 AM
How to merge two worksheets in one. Vanessa Simmonds Excel Discussion (Misc queries) 0 June 27th 07 12:28 PM
merge worksheets Mike Bubyn Excel Worksheet Functions 0 November 16th 05 10:34 PM
Merge Worksheets Douglas McDonald Excel Discussion (Misc queries) 3 October 17th 05 10:20 PM
Worksheets won't merge! Frustrated!!!! Excel Worksheet Functions 1 September 20th 05 03:09 AM


All times are GMT +1. The time now is 10:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"