Splitting Workbooks with Multiple Sheets into Multiple Workbooks

jarvisaurus

Board Regular
Joined
Nov 26, 2010
Messages
52
I have 3 workbooks e.g. named A,B,C with multiple sheets 1-30. For each sheet in each workbook, I would like to move those sheets e.g. Workbooks(A).Sheet(1), Workbooks(B).Sheet(1), Workbooks(C).Sheet(1) into one workbook named Sheet(1).

The # of sheets in each workbook can vary.

Is this possible?

I tried the combining a code from some I found:

PHP:
Sub MoveOPPSheetsNB()
Dim SrcBook As Workbook
Dim FSO As Object, f As Object, ff As Object, f1 As Object, nwb As Workbook
Dim NumSht As Integer
Dim BegSht As Integer
Application.ScreenUpdating = False
Set FSO = CreateObject("Scripting.FileSystemObject")
Set f = FSO.Getfolder("C:\Documents and Settings\USER\Desktop\test2") 'change this path
Set ff = f.Files
 
For Each f1 In ff
Set SrcBook = Workbooks.Open(f1)
For i = 2 To Sheets.Count
SrcBook.Sheets(i).Move
ChDir "C:\Documents and Settings\USER\Desktop\test2"
SrcBook.Save
SrcBook.Close
Next i
Next
End Sub

I got the following error:

"method of 'Sheets' of object '_Workbook' Failed"

Any help is greatly appreciated. Thanks.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,224,592
Messages
6,179,786
Members
452,942
Latest member
VijayNewtoExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top