You can use the following macro if your filenames are really as you said. Further you need to change the path to the file. You need to check the name of sheet also. Hope it helps. '----------------------------------------------------- Sub combineWorkbooks Dim i As Integer Dim j As Integer Dim w1 As Workbook Dim w2 As Workbook For i = 1 To 1 Workbooks.Open Filename:="C:\data" & i & "s.xls" 'change the file path name Set w1 = ActiveWorkbook Workbooks.Open Filename:="C:\data" & i & "g.xls" 'change the file path name Set w2 = ActiveWorkbook Sheets("Sheet1").Copy Before:=w1.Sheets(2) ' check the sheet name ' change the path name to the following output file ActiveWorkbook.SaveAs Filename:="C:\data" & i & ".xls" w1.Close w2.Close Next i Set w1 = Nothing Set w2 = Nothing End Sub '-----------------------------------------------------
On Wed, Sep 3, 2008 at 8:37 PM, A.A.A <[EMAIL PROTECTED]> wrote: > > Hi, > I have 300 excel files and another different 300. I want to merge one > from the first 300 to one from the other 300,so that i will end up by > 300 excel files each having 2 sheets one for the data from the first > 300 files and the second sheet carrying the data from the other 300. > Is this possible?If possible, could you explain the steps as i am new > with the excel macros? > > My files are named like the following: > > first 300: datas1,datas2,datas3,.....datas300 > > Second 300: datag1,datag2,datag3,.....datag300 > > and I want to have 300 files each consisting of 2 sheets : > > data1,data2,data3,...data300 > > so that data1 consists of 2 sheets the first is for the data of datas1 > and the second is for the data of datag1 > > data2 consists of 2 sheets the first is for the data of > datas2 and the second is for the data of datag2 > > and so on......................................................... > > > Aya > > > > -- Akhilesh Kumar Karna --~--~---------~--~----~------------~-------~--~----~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to this group, send email to excel-macros@googlegroups.com For more options, visit this group at http://groups.google.com/group/excel-macros?hl=en Visit & Join Our Orkut Community at http://www.orkut.com/Community.aspx?cmm=22913620 Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com -~----------~----~----~----~------~----~------~--~---