View Full Version : "Do While" issue


proballin
09-14-2009, 09:16 AM
The code below works fine as far as putting the right things in each cell. However the code just continues to loop and never exits. Is the first line in my code correct?


Do While Cells(i, 1).value = "Chicago"
Cells(i, 4).Select
Selection.Copy
Sheets("Chicago").Select
Cells(a, g).Select
ActiveSheet.Paste
i = i + 1
g = g + 1
Sheets("Status_Report_SUM").Select
Loop

ajetrumpet
09-14-2009, 10:20 AM
maybe you've broken a rule. maybe this:do while cells(a, b) = somethingreally tells the program this:

"remember the value in cells(a, b) when this loop starts"
"run this until that value changes"


if that's really what's happening, that's why its not stopping. value doesn't change. :)

either that...or there's an unwritten rule between switching back and forth between pages like you're doing.

proballin
09-14-2009, 10:34 AM
That looks to have solved the problem. I just took off the ".value" off of Cells(i, 1). Thanks!