ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   inserting a sheet into multiple workbooks (https://www.excelbanter.com/excel-discussion-misc-queries/61089-inserting-sheet-into-multiple-workbooks.html)

spence

inserting a sheet into multiple workbooks
 
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

JackL

inserting a sheet into multiple workbooks
 
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.

"spence" wrote:

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


Ron de Bruin

inserting a sheet into multiple workbooks
 
Hi spence

Try this one
http://www.rondebruin.nl/copy4.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"spence" wrote in message ...
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





All times are GMT +1. The time now is 04:12 PM.

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