Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stop excel from dropping the 0 in the beginning of a number? | Setting up and Configuration of Excel | |||
unhide menu bar in excel - just disappeared | Setting up and Configuration of Excel | |||
Can I embed or link multiple .pdf files into or to an excel file? | Excel Discussion (Misc queries) | |||
Putting Excel formatting and/or formulas into CSV file | Excel Discussion (Misc queries) | |||
Read Text File into Excel Using VBA | Excel Discussion (Misc queries) |