Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 52
Default assemble worksheets into one workbook

Is there an easy macro I can use to take all the workbooks in a folder and
save them as a single workbook with multiple tabs?

Each workbook has only one tab, and I would like to save them in one
workbook with multiple tabs.

I know this can be done manually, but I have to do it every day, so a macro
would be much easier.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default assemble worksheets into one workbook

Jill,

Copy this macro into an otherwise blank workbook.

HTH,
Bernie
MS Excel MVP

Sub Consolidate()
Dim i As Integer
With Application.FileSearch
.NewSearch
'Change this to your directory
.LookIn = "H:\USERS\Jill"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
ActiveSheet.Name = Left(ActiveWorkbook.Name, _
Len(ActiveWorkbook.Name) - 4)
ActiveSheet.Move After:=ThisWorkbook.Sheets(1)
Next i
Else: MsgBox "There were no files found."
End If

End With

End Sub



"Jill" wrote in message
...
Is there an easy macro I can use to take all the workbooks in a folder and
save them as a single workbook with multiple tabs?

Each workbook has only one tab, and I would like to save them in one
workbook with multiple tabs.

I know this can be done manually, but I have to do it every day, so a macro
would be much easier.

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 52
Default assemble worksheets into one workbook

That works great, thanks!

"Bernie Deitrick" wrote:

Jill,

Copy this macro into an otherwise blank workbook.

HTH,
Bernie
MS Excel MVP

Sub Consolidate()
Dim i As Integer
With Application.FileSearch
.NewSearch
'Change this to your directory
.LookIn = "H:\USERS\Jill"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
ActiveSheet.Name = Left(ActiveWorkbook.Name, _
Len(ActiveWorkbook.Name) - 4)
ActiveSheet.Move After:=ThisWorkbook.Sheets(1)
Next i
Else: MsgBox "There were no files found."
End If

End With

End Sub



"Jill" wrote in message
...
Is there an easy macro I can use to take all the workbooks in a folder and
save them as a single workbook with multiple tabs?

Each workbook has only one tab, and I would like to save them in one
workbook with multiple tabs.

I know this can be done manually, but I have to do it every day, so a macro
would be much easier.

Thanks!




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 173
Default assemble worksheets into one workbook

Bernie or anyone who can help,

I am trying to do the same thing. You say copy it into a blank workbook?
What exactly do you mean by this? Do i have to create a new macro?

Thanks

"Jill" wrote:

That works great, thanks!

"Bernie Deitrick" wrote:

Jill,

Copy this macro into an otherwise blank workbook.

HTH,
Bernie
MS Excel MVP

Sub Consolidate()
Dim i As Integer
With Application.FileSearch
.NewSearch
'Change this to your directory
.LookIn = "H:\USERS\Jill"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
ActiveSheet.Name = Left(ActiveWorkbook.Name, _
Len(ActiveWorkbook.Name) - 4)
ActiveSheet.Move After:=ThisWorkbook.Sheets(1)
Next i
Else: MsgBox "There were no files found."
End If

End With

End Sub



"Jill" wrote in message
...
Is there an easy macro I can use to take all the workbooks in a folder and
save them as a single workbook with multiple tabs?

Each workbook has only one tab, and I would like to save them in one
workbook with multiple tabs.

I know this can be done manually, but I have to do it every day, so a macro
would be much easier.

Thanks!




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default assemble worksheets into one workbook

For office 2007 it is not working ?

"Neil" wrote:

Bernie or anyone who can help,

I am trying to do the same thing. You say copy it into a blank workbook?
What exactly do you mean by this? Do i have to create a new macro?

Thanks

"Jill" wrote:

That works great, thanks!

"Bernie Deitrick" wrote:

Jill,

Copy this macro into an otherwise blank workbook.

HTH,
Bernie
MS Excel MVP

Sub Consolidate()
Dim i As Integer
With Application.FileSearch
.NewSearch
'Change this to your directory
.LookIn = "H:\USERS\Jill"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
ActiveSheet.Name = Left(ActiveWorkbook.Name, _
Len(ActiveWorkbook.Name) - 4)
ActiveSheet.Move After:=ThisWorkbook.Sheets(1)
Next i
Else: MsgBox "There were no files found."
End If

End With

End Sub



"Jill" wrote in message
...
Is there an easy macro I can use to take all the workbooks in a folder and
save them as a single workbook with multiple tabs?

Each workbook has only one tab, and I would like to save them in one
workbook with multiple tabs.

I know this can be done manually, but I have to do it every day, so a macro
would be much easier.

Thanks!



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
Create New Workbook from Worksheets in One Workbook Dave Excel Discussion (Misc queries) 4 June 17th 07 10:27 PM
Many worksheets in a workbook zhj23 Excel Discussion (Misc queries) 3 June 17th 07 04:10 PM
Add 6 worksheets in workbook Phil New Users to Excel 4 March 31st 06 03:29 AM
How do I build a workbook from the worksheets another workbook? Rico Excel Discussion (Misc queries) 4 August 19th 05 02:04 PM
assemble link from different cells and return value tastic96 Excel Worksheet Functions 2 June 27th 05 01:00 PM


All times are GMT +1. The time now is 04:26 PM.

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

About Us

"It's about Microsoft Excel"