View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Combining Multilple Worksheets Into One

hi,

Am Thu, 9 Aug 2012 09:51:38 -0700 (PDT) schrieb djc:

I have an issue I think may be easy to solve, but I am a novice with VBA. I need macro that can combine multiple sheets into one sheet.

I have 300+ sheets all named 1-300+ (there are a few missing sheets within the range however). The good news is that each sheet is a template and I need to extract only the data in the range A13:P55.

I would like to extract A13:P55 from the first worksheet ?1? and place it in a sheet called ?Combined?.

The macro would then go to the next worksheet, and pull A13:P55 and put in that range in the ?Combined? tab below the data it from the previous worksheet.


try:
Sub Combine()
Dim LRow As Long
Dim wsh As Worksheet

For Each wsh In ThisWorkbook.Worksheets
LRow = Sheets("Combined").Cells(Rows.Count, 1).End(xlUp).Row + 1
With wsh
If .Name < "Combined" Then
.Range("A13:P55").Copy _
Destination:=Sheets("Combined").Range("A" & LRow)
End If
End With
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2