Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default COMBINING WORKBOOKS

I have 32 workbooks with 3 worksheets each. Each worksheet in each workbook
is named the same. I need to combine all 32 workbooks into one files with
each of the 3 sheets moved. This will make for a total of 96 sheets. I
really don't want to have to open each file and copy the worksheets to a
master sheet.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default COMBINING WORKBOOKS

Try something like:

Option Explicit

Sub CopySheets()
Dim Wb As Workbook
Dim i As Integer
Dim j As Integer

On Error Resume Next
''GET THE FIRST WB
Set Wb = Workbooks.Open(Dir(ThisWorkbook.Path & "\*.xls"))
For i = 1 To 3
Wb.Sheets(i).Copy After:=ThisWorkbook.Sheets(1)
Next i
Wb.Close False

''GET REMAINING WBKS
For j = 1 To 32
If Wb.Name < ThisWorkbook.Name Then
Set Wb = Workbooks.Open(Dir)
For i = 1 To 3
Wb.Sheets(i).Copy After:=ThisWorkbook.Sheets(1)
Next i
Wb.Close False
End If
Next j

Set Wb = Nothing

End Sub

"lmarstin" wrote:

I have 32 workbooks with 3 worksheets each. Each worksheet in each workbook
is named the same. I need to combine all 32 workbooks into one files with
each of the 3 sheets moved. This will make for a total of 96 sheets. I
really don't want to have to open each file and copy the worksheets to a
master sheet.

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
Combining two workbooks WLMPilot Excel Discussion (Misc queries) 0 December 13th 07 07:25 PM
Combining Workbooks RonnieF Charts and Charting in Excel 0 May 17th 07 08:40 PM
combining workbooks John[_19_] Excel Programming 1 October 3rd 06 11:47 PM
combining 2 workbooks Dana Excel Discussion (Misc queries) 0 March 22nd 06 09:44 PM
Combining several workbooks into one Anders Eriksson Excel Programming 4 May 13th 04 04:53 PM


All times are GMT +1. The time now is 02:44 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"