View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Mass copy of excel docs

How can the several documents be identified. To they all start with a
common root word. Are they the only .xls files in a directory.

Copy to a new template -

do you want to consolidate all on one page

Dim bk1 as Workbook, bk as Workbook
Dim sName as String, dim rng as Range
set bk1 = Workbooks.Add
sName = Dir("C:\MyDocs\*.xls")
do while sName < ""
set bk = Workbooks.Open("C:\MyDocs\" & sName)
bk.worksheets(1).Range("A1").Resize(5,5).copy
set rng = bk1.Worksheets(1).Cells(rows.count,1).End(xlup)(2)
rng.PasteSpecial xlValues
bk.close SaveChanges:=False
sName = Dir()
Loop

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
I have {30} several documents -- Excel that I want to copy some cells
to a new template. I want to use a macro for this. Any suggestions??