![]() |
how do i add a particular sheet to more than one excel files
Hi ,
I stuck to problem actually i want to add a particular sheet to the more than 50 excel files at the same time because i have got 50 files so its time consuming to open them one by one .please help me in this regard. Thanks U.A |
how do i add a particular sheet to more than one excel files
Try this:-
Code goes in your donor workbook. Alter the path and sheet name to suit:- Sub LoopFiles() Dim sDirectory As String Dim sSpec As String Dim sBook As String Dim oBook As Workbook sDirectory = "c:\myfiles" '< Change to suit sSpec = "*.xls" sBook = Dir(sDirectory & "\" & sSpec) Do Worksheets("Sheet4").Select Worksheets("sheet4").Cells.Select '< Change copied sheet to suit Selection.Copy Set oBook = Workbooks.Open(sDirectory & "\" & sBook) Windows(sBook).Activate Sheets.Add.Name = "My Copied Sheet" '< Change to suit Cells.Select ActiveSheet.Paste oBook.Save oBook.Close sBook = Dir() Loop Until sBook = "" End Sub Mike "sonu" wrote: Hi , I stuck to problem actually i want to add a particular sheet to the more than 50 excel files at the same time because i have got 50 files so its time consuming to open them one by one .please help me in this regard. Thanks U.A |
All times are GMT +1. The time now is 11:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com