Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"m5u4r3p2h1y" wrote:
in message ... was hoping if anyone code tell me why the following code only loops once. [....] Dim i, count As Integer [....] For i = 0 To i = 9 The For statement should be: For i = 0 to 9 As you wrote, it is parsed as: For i = 0 to (i = 9) "i = 9" returns True (-1) or False (0). Since i=0 initially, "i = 9" is False (0). So your For statement is effectively: For i = 0 to 0 which will indeed loop only once. By the way, you Dim statement should probably be at least: Dim i As Integer, count As Integer As you wrote it, i is Variant. I suspect that was not your intent. Also, there is little point in using Integer type, unless you have very huge arrays. You should use Long to be flexible. There is no performance cost in modern computers. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sum of yes answers | Excel Worksheet Functions | |||
multiple answers | Excel Worksheet Functions | |||
Please help me with answers | Excel Discussion (Misc queries) | |||
new user with easy question? not easy for me | New Users to Excel | |||
Does anyone know the answers to | Links and Linking in Excel |