inserting a sheet into multiple workbooks

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 500+ identical single-sheet workbooks in a folder and would like to
insert a sheet from another workbook into all of them. Is there a way to do
this in a batch w/o have to open each one and copying the sheet? Thanks.

spence
 
Hi Spence,
If you are familiar with VBA you can write a module to what you are asking.
The DIR function is very useful. You can load an array with all the excel
workbook path+names in a given folder i.e.:

MyFile = Dir(MyPath + "\*.xls")
' Load an array with all .xls file names found in the given path
aFileArray(1) = MyPath + "\" + MyFile
For i = 2 To 500
MyFile = Dir
If MyFile <> "" Then
aFileArray(i) = MyPath + "\" + MyFile
ElseIf MyFile = "" Then
Exit For
End If
Next i

Then recursively open each one and paste your worksheet. Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top