View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
aflatoon[_20_] aflatoon[_20_] is offline
external usenet poster
 
Posts: 1
Default For statement behaving very strangely


Hi,
Could you clarify what you mean by "unexpected results"? I can't see
anything odd about that loop.


michael.beckinsale;731113 Wrote:

Hi All,

The following For...Next statement appears to be giving the incorrect
results. My original code was to loop through rows 6 to 1200 in column
AB and hide each row whre the value was 0. I found that the 1st 900 or
so rows did not appear to be evaluated but the remaining 300 did and
the rows were hidden. Further testing and use of the immediate window
showed that indeed this was true. If l change the number of rows as
being 6 to 100 and/or 6 to 250 all rows are evaluated as expected. As
soon as l increase the number of rows above 250 l get unexpected
results. Does anybody know what is causing this? I have used this sort
of code structure many times without any problems.

Sub TTS_HideRowsTest()
Dim MyRow As Long
Sheets("Budget Input").Activate
MyRow = 0
For MyRow = 6 To 250
Debug.Print Cells(MyRow, "AB").Address
Next
End Sub

Regards

Michael



--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: http://www.thecodecage.com/forumz/member.php?u=1501
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=204918

http://www.thecodecage.com/forumz