Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Merge multiple worksheets into one worksheet.

I have about 200 worksheets, all saved as separate files, that need to be
merged into one worksheet. For example, I have AL.xls, FL.xls, and GA.xls.
Each file contains a single worksheet. I need the data in FL.xls and GA.xls
to be in the same worksheet as AL.xls

I found the following code at
http://exceltips.vitalnews.com/Pages...Workbooks.html

Sub CombineWorkbooks()
Dim FilesToOpen
Dim x As Integer

On Error GoTo ErrHandler
Application.ScreenUpdating = False

FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Files to Merge")

If TypeName(FilesToOpen) = "Boolean" Then
MsgBox "No Files were selected"
GoTo ExitHandler
End If

x = 1
While x <= UBound(FilesToOpen)
Workbooks.Open FileName:=FilesToOpen(x)
Sheets().Move After:=ThisWorkbook.Sheets _
(ThisWorkbook.Sheets.Count)
x = x + 1
Wend

ExitHandler:
Application.ScreenUpdating = True
Exit Sub

ErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub


It works really well except that it puts the data in the same workbook but
on separate tabs. I need the data all together on one tab. Is there a way to
do this with a macro?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Merge multiple worksheets into one worksheet.

Hi Raewyn

Try this add-in
http://www.rondebruin.nl/merge.htm

Or use the code in the links on the bottom of that page


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Raewyn" wrote in message ...
I have about 200 worksheets, all saved as separate files, that need to be
merged into one worksheet. For example, I have AL.xls, FL.xls, and GA.xls.
Each file contains a single worksheet. I need the data in FL.xls and GA.xls
to be in the same worksheet as AL.xls

I found the following code at
http://exceltips.vitalnews.com/Pages...Workbooks.html

Sub CombineWorkbooks()
Dim FilesToOpen
Dim x As Integer

On Error GoTo ErrHandler
Application.ScreenUpdating = False

FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Files to Merge")

If TypeName(FilesToOpen) = "Boolean" Then
MsgBox "No Files were selected"
GoTo ExitHandler
End If

x = 1
While x <= UBound(FilesToOpen)
Workbooks.Open FileName:=FilesToOpen(x)
Sheets().Move After:=ThisWorkbook.Sheets _
(ThisWorkbook.Sheets.Count)
x = x + 1
Wend

ExitHandler:
Application.ScreenUpdating = True
Exit Sub

ErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub


It works really well except that it puts the data in the same workbook but
on separate tabs. I need the data all together on one tab. Is there a way to
do this with a macro?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Merge multiple worksheets into one worksheet.

Thank you. That was exactly what I needed.


"Ron de Bruin" wrote:

Hi Raewyn

Try this add-in
http://www.rondebruin.nl/merge.htm

Or use the code in the links on the bottom of that page


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Raewyn" wrote in message ...
I have about 200 worksheets, all saved as separate files, that need to be
merged into one worksheet. For example, I have AL.xls, FL.xls, and GA.xls.
Each file contains a single worksheet. I need the data in FL.xls and GA.xls
to be in the same worksheet as AL.xls

I found the following code at
http://exceltips.vitalnews.com/Pages...Workbooks.html

Sub CombineWorkbooks()
Dim FilesToOpen
Dim x As Integer

On Error GoTo ErrHandler
Application.ScreenUpdating = False

FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Files to Merge")

If TypeName(FilesToOpen) = "Boolean" Then
MsgBox "No Files were selected"
GoTo ExitHandler
End If

x = 1
While x <= UBound(FilesToOpen)
Workbooks.Open FileName:=FilesToOpen(x)
Sheets().Move After:=ThisWorkbook.Sheets _
(ThisWorkbook.Sheets.Count)
x = x + 1
Wend

ExitHandler:
Application.ScreenUpdating = True
Exit Sub

ErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub


It works really well except that it puts the data in the same workbook but
on separate tabs. I need the data all together on one tab. Is there a way to
do this with a macro?


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
merge multiple worksheets from multiple excel files into oneworksheet Shamoun Ilyas Excel Discussion (Misc queries) 5 November 19th 08 09:48 PM
is it possible to "merge" multiple worksheets into one worksheet? Jerry Bennett[_2_] Excel Discussion (Misc queries) 1 June 27th 08 06:31 PM
Merge Multiple Worksheets cyndi Excel Discussion (Misc queries) 1 January 28th 08 07:18 PM
Combin / Merge Multiple Worksheets / sheets into one worksheet / sheet [email protected] Excel Worksheet Functions 3 December 14th 06 02:13 AM
merge multiple worksheets dbsudy Excel Discussion (Misc queries) 0 March 13th 06 08:14 PM


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