RATE THIS ANSWER
+1
Click to Vote:
1
0
Your code has a couple of problems (common errors, by the way). (1) Your variable, Start, is never changed within the loop - never changed at all, really. You do change the value of cell A1 to 2, but then you don't refresh the value of Start by reading A1. (2) You test for the end value, 5, and if true, jump out of the loop before saving worksheet 5.xls. I changed the = to > in the Do-Loop test line to fix that problem.
Here's a simplified version of the code:
Sub saveFive()
Start = Workbooks("Loop Test.xls").Worksheets("Sheet1").Range("A1").Value
Finish = Workbooks("Loop Test.xls").Worksheets("Sheet1").Range("A4").Value
Do Until Start > Finish
Set NewBook = Workbooks.Add
With NewBook
.SaveAs Filename:=Start
.Close SaveChanges:=True
End With
Start = Start + 1
Loop
End Sub
I left out updating cell A1, but you could put it back in if needed. You also had a line with the Workbooks.Save() method, which is unnecessary because Workbooks.SaveAs has already accomplished that task.
Last Answered:
Mar 9 2009 5:53 PM GMT by Ledlincoln 
1220 pts.