Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
buffgirl71
 
Posts: n/a
Default Combine multiple workbooks into 1 workbook w/ multiple worksheets

I have multiple workbooks that I want to combine into one workbook,
putting each of the original workbooks into a new worksheet. Is there
some way I can do that automatically, without cutting and pasting each
workbook?

  #2   Report Post  
Posted to microsoft.public.excel.misc
mrice
 
Posts: n/a
Default Combine multiple workbooks into 1 workbook w/ multiple worksheets


Yes there is.

Put this macro on a macro module sheet in a new workbook.
Put all the workbooks that you want to combine into the same directory
Change the path in the macro to the one that you are using
Run the macro

Sub GetSheets()
Path = "C:\documents and settings\Martin\my documents\"
Filename = Dir(Path & "*.xls")

Do While Filename < ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub


This will add all the sheets to the new workbook.


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=541686

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
Print all charts in a workbook (multiple worksheets) aewsaws Charts and Charting in Excel 4 May 12th 23 03:45 AM
combine multiple worksheets & files into 1 Barb Excel Worksheet Functions 3 October 7th 05 11:43 PM
create multiple worksheets in workbook from one csv file Lost in Windows Excel Discussion (Misc queries) 1 July 24th 05 02:42 AM
Combine Workbooks as separate worksheets SAL Excel Discussion (Misc queries) 2 June 1st 05 04:30 PM
Multiple worksheets, multiple workbooks peter marsh Excel Worksheet Functions 1 January 4th 05 03:55 AM


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