assemble excel workbook

  • Thread starter Thread starter handjive
  • Start date Start date
H

handjive

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

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
 
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
 
Back
Top