• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Adding a Sheet to a bunch of selected Workbooks [SOLVED]

alemuzzy

New Member
I was wondering if there is a way add a sheet or two from one workbook into a certain number of existing workbooks without having to manually do it one by one. Either an automated way of doing it or being able to select all the workbooks you want to add the specific sheet. If anyone knows a method of doing this please let me know.

Thanks in advance
 
You could loop through the different files you want to copy sheets to, and use something like this


Workbooks("SourceFile.xlsm").Sheets(Array("Sheet1", "Sheet2")).Copy After:=wbk.Sheets(3)


Where wbk will be your destination workbook variable, and the 3 can be the index of the sheet in the destination workbook (wbk) after which you want the sheets from the source worokbook, to be copied to.
 
Hey can you give me an example of what the wbk variable would look like? Is it the actual path of the file or just the name of the workbook? Thanks
 
wbk is a variable that hold one workbook at a time and loop in all your destination workbook(s); those destination files can be browsed for example.


you can check this file for a compleate code.

http://www.mediafire.com/download/c57it3z5xwhdqs7/AddSheets.xlsm


regards
 
imla this is amazing thanks a lot and I really understood your code thanks to the comments! I'll give you all my internet points for the day.

Cheers!
 
Back
Top