J
jwang036
Hi, I have a model generating some result (the final sheet is called
"Result") and I need to do 80 different tests. After each test I take out
the "result' sheet and put it into a summary file (LTP) and name the sheet
name as the test code. I use the following script. The LTP file has a start
sheet (sheet1). I copy that sheet1 and copy paste the result onto it then do
the next one. It works fine then stops after about 20 sheets. I can't even
manaully copy one more sheet (you know the drag-and-copy an existing sheet).
Any idea why? and how can I keep inserting work sheets. Thanks.
'Start the loop,from the 1st store of inputs
For RowNum = 1 To 80
Windows("LTP").Activate
Sheets("Sheet1").Copy After:=Sheets(1)
.......Skip the generating result put......
'take out result sheet ,copy & paste value and change "Result" to test
code
Sheets("Result").Select
Cells.Select
Selection.Copy
Windows("LTP.xls").Activate
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats
Sheets("Sheet1 (2)").Name = TestCode
Next RowNum
"Result") and I need to do 80 different tests. After each test I take out
the "result' sheet and put it into a summary file (LTP) and name the sheet
name as the test code. I use the following script. The LTP file has a start
sheet (sheet1). I copy that sheet1 and copy paste the result onto it then do
the next one. It works fine then stops after about 20 sheets. I can't even
manaully copy one more sheet (you know the drag-and-copy an existing sheet).
Any idea why? and how can I keep inserting work sheets. Thanks.
'Start the loop,from the 1st store of inputs
For RowNum = 1 To 80
Windows("LTP").Activate
Sheets("Sheet1").Copy After:=Sheets(1)
.......Skip the generating result put......
'take out result sheet ,copy & paste value and change "Result" to test
code
Sheets("Result").Select
Cells.Select
Selection.Copy
Windows("LTP.xls").Activate
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats
Sheets("Sheet1 (2)").Name = TestCode
Next RowNum