A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Combining Multilple Worksheets Into One



 
 
Thread Tools Display Modes
  #1  
Old August 9th 12, 05:51 PM posted to microsoft.public.excel.programming
djc[_3_]
external usenet poster
 
Posts: 6
Default Combining Multilple Worksheets Into One

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.

This process would go until it completes all 300+ worksheets.
Is this possible?

Any feedback would be most helpful. Thank you for your time.
Ads
  #2  
Old August 9th 12, 06:25 PM posted to microsoft.public.excel.programming
Claus Busch
external usenet poster
 
Posts: 943
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
  #3  
Old August 9th 12, 06:59 PM posted to microsoft.public.excel.programming
djc[_3_]
external usenet poster
 
Posts: 6
Default Combining Multilple Worksheets Into One

Hi Claus, Thank you for the quick reply. It works quickly, however it seems to be missing column A when it combines. It puts column B from the worksheets into column A of the Combined tab. Column A is a formula. Does that have anything to do with? Ideally, all the numbers and text come in are values and not formulas.

Thanks again,

  #4  
Old August 9th 12, 07:06 PM posted to microsoft.public.excel.programming
djc[_3_]
external usenet poster
 
Posts: 6
Default Combining Multilple Worksheets Into One

Hi Claus,I did some more research, There were other roll up tabs that were skewing the data. It worked well. I failed to mention the formulas in my first post. I would like the macro to return values only and not any formulas (my ultimate goal is to get this into a flat file).

Thank you again. djc
  #5  
Old August 9th 12, 07:18 PM posted to microsoft.public.excel.programming
Claus Busch
external usenet poster
 
Posts: 943
Default Combining Multilple Worksheets Into One

Hi,

Am Thu, 9 Aug 2012 11:06:05 -0700 (PDT) schrieb djc:

> Hi Claus,I did some more research, There were other roll up tabs that were skewing the data. It worked well. I failed to mention the formulas in my first post. I would like the macro to return values only and not any formulas (my ultimate goal is to get this into a flat file).


then 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
Sheets("Combined").Range("A" & LRow) _
.PasteSpecial xlPasteValues
End If
End With
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #6  
Old August 9th 12, 07:44 PM posted to microsoft.public.excel.programming
djc[_3_]
external usenet poster
 
Posts: 6
Default Combining Multilple Worksheets Into One

I added just the PasteSpecial line and it the previous macro and it worked perfect! Thank you!
  #7  
Old August 9th 12, 08:35 PM posted to microsoft.public.excel.programming
magmike[_2_]
external usenet poster
 
Posts: 25
Default Combining Multilple Worksheets Into One

On Thursday, August 9, 2012 11:51:38 AM UTC-5, djc wrote:
> 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. This process would go until it completes all 300+ worksheets. Is this possible? Any feedback would be most helpful. Thank you for your time.


Ron De Bruin has created a fantastic Add-In that does just this beautifully and is flexible to work in different scenarios. I use it often and it's free:
http://www.rondebruin.nl/merge.htm
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
combining worksheets antony Excel Worksheet Functions 0 July 1st 08 11:12 PM
Combining worksheets Steven Hunns New Users to Excel 1 January 10th 08 03:29 PM
Help searching and summing across multilple worksheets Joe Tapestry Excel Discussion (Misc queries) 7 March 17th 06 05:07 AM
Combining 2 or more worksheets Steve Lewington Excel Worksheet Functions 3 February 1st 06 05:36 PM
combining two worksheets into one KK[_4_] Excel Programming 3 January 9th 06 08:08 PM


All times are GMT +1. The time now is 02:05 AM.


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