Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
dbguy11
 
Posts: n/a
Default Combine worksheets from different excel files into one excel file

I need to combine about 16 different excel files (one workbook each) into
excel file. I don't want to combine them all into one worksheet. I need to
keep them separate, but in the same workbook. They all have the same format.
Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Combine worksheets from different excel files into one excel file

Are they all in the same folder?

If yes, then run this and select the files that should be combined:

Option Explicit
Sub testme01()

Dim myFileNames As Variant
Dim wkbk As Workbook
Dim fCtr As Long
Dim newWkbk As Workbook

myFileNames = Application.GetOpenFilename("Excel Files, *.xls", _
MultiSelect:=True)

If IsArray(myFileNames) = False Then
Exit Sub
End If

Set newWkbk = Workbooks.Add(1) 'single sheet
newWkbk.Worksheets(1).Name = "dummynamehere"

For fCtr = LBound(myFileNames) To UBound(myFileNames)
Set wkbk = Workbooks.Open(Filename:=myFileNames(fCtr))
wkbk.Worksheets(1).Copy _
after:=newWkbk.Worksheets(1)
wkbk.Close savechanges:=False
Next fCtr

Application.DisplayAlerts = False
newWkbk.Worksheets("dummynamehere").Delete
Application.DisplayAlerts = True
End Sub



dbguy11 wrote:

I need to combine about 16 different excel files (one workbook each) into
excel file. I don't want to combine them all into one worksheet. I need to
keep them separate, but in the same workbook. They all have the same format.
Thanks in advance.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Doug Kanter
 
Posts: n/a
Default Combine worksheets from different excel files into one excel file


"dbguy11" wrote in message
...
I need to combine about 16 different excel files (one workbook each) into
excel file. I don't want to combine them all into one worksheet. I need to
keep them separate, but in the same workbook. They all have the same
format.
Thanks in advance.


Right click the tab at the bottom and you'll see options for copying the
sheet. You can make a copy that stays in the same workbook, or send the copy
to a new workbook, or...the one you want: Copy it into an existing workbook.
The workbook that receives the copy must be open at the time of the copy.


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
Stop excel from dropping the 0 in the beginning of a number? Rosewood Setting up and Configuration of Excel 12 April 4th 23 02:12 PM
unhide menu bar in excel - just disappeared Sean Setting up and Configuration of Excel 12 April 4th 23 10:19 AM
Can I embed or link multiple .pdf files into or to an excel file? GrubbyG Excel Discussion (Misc queries) 1 October 3rd 05 08:40 PM
Putting Excel formatting and/or formulas into CSV file Frank D. Nicodem, Jr. Excel Discussion (Misc queries) 1 July 11th 05 10:18 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


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