You need some sort of loop, so if your files have a naming convention it is
easy.
In addition, if you want to add to separate sheets, you can just move them
Set wb = Activeworkbook
For i = 1 To 30
Workbooks.Open Filename:="myFile " & i & ".xls"
ActiveWorkbook.Worksheets("Sheet1").Copy _
After:=wb.Worksheets(wb.Worksheets.Count)
ActiveWorkbook.Close savechanges:=False
Next i
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Losse" wrote in message
...
I would like to fully automate copying the data from a few Excel files
and pasting the data from each onto separate sheets on one file. I
would like to do it from 1-30per. I have no idea how to do it, but this
is my attempt that is doomed to fail:
Do While Rng <= 30
For i = 1 To Rng
Windows(out13_T300K_Rngper2000).Activate
Columns("A:B").Select
Selection.Copy
Application.WindowState = xlMinimized
Windows(out13_iper2000).Activate
sheets.Add
ActiveSheet.Paste
ActiveSheet.Name = "300"
Windows(out13_T600K_Rngper2000).Activate
Columns("A:B").Select
Selection.Copy
Application.WindowState = xlMinimized
Windows(out13_iper2000).Activate
sheets.Add
ActiveSheet.Paste
ActiveSheet.Name = "600"
Windows(out13_T900K_Rngper2000).Activate
Columns("A:B").Select
Selection.Copy
Application.WindowState = xlMinimized
Windows(out13_iper2000).Activate
sheets.Add
ActiveSheet.Paste
ActiveSheet.Name = "900"
Call Grapher
Next i
Loop
--
Losse
------------------------------------------------------------------------
Losse's Profile:
http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=388024