ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   assemble excel workbook (https://www.excelbanter.com/excel-programming/277845-assemble-excel-workbook.html)

handjive

assemble excel workbook
 
Excel Folks:

I'd like to asemble several excel worksheets and/or
workbooks into a single workbook. Is there a quicker way
to do this than manually cutting and pasting between
workbooks? Eg:

workbook1 includes sheet a,b, and c

wokbook2 includes sheet d,e, and f

correct incantation occurs <<


workbook3 includes sheet a,b,c,d,e, and f



Similarly, is there a way to import multiple .csv files
into a single workbook in one fell swoop?



Thanks to anyone who can help!

handjive


Tom Ogilvy

assemble excel workbook
 
Sub CopyWorkbooksSheets()
With Workbooks("Bk3.xls")
workbooks("Bk1.xls").Sheets.Copy _
After:=.Worksheets(.worksheets.count)
workbooks("Bk2.xls").Sheets.Copy _
After:=.Worksheets(.worksheets.count)
' add more as necessary
End Sub


Sub CopyCSV()
Dim sPath as String
Dim fNames as Variant
sPath = "C:\My Documents\"
fnames = Array("CSV1.csv", "CSV2.csv", "CSV3.csv")
Application.ScreenUpdating = False
for i = lbound(fnames) to ubound(fnames)
set wkbk = workbooks.open(sPath & fNames(i))
Activesheet.copy _
After:=Workbooks("Bk3.xls").Worksheets( _
Workbooks("Bk3.xls").Worksheets.count)
wkbk.Close SaveChanges:=False
Next
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy


handjive wrote in message
...
Excel Folks:

I'd like to asemble several excel worksheets and/or
workbooks into a single workbook. Is there a quicker way
to do this than manually cutting and pasting between
workbooks? Eg:

workbook1 includes sheet a,b, and c

wokbook2 includes sheet d,e, and f

correct incantation occurs <<


workbook3 includes sheet a,b,c,d,e, and f



Similarly, is there a way to import multiple .csv files
into a single workbook in one fell swoop?



Thanks to anyone who can help!

handjive





All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com