Isn't there some loop that allows non-sequential numbers? I thought I had
come across or actually used something like:
For n = 0 to 4, 6 to 10
Next n
Any suggestions?

Signature
Bill Reed
"If you can't laugh at yourself, laugh at somebody else"
Alex Dybenko - 13 May 2008 15:47 GMT
hi,
perhaps something like this:
Dim a() As Variant, i As Integer
a() = Array(1, 4, 6, 8, 88)
For i = LBound(a) To UBound(a)
Debug.Print a(i)
Next i

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
> Isn't there some loop that allows non-sequential numbers? I thought I had
> come across or actually used something like:
[quoted text clipped - 4 lines]
>
> Any suggestions?
Stefan Hoffmann - 13 May 2008 15:57 GMT
hi Bill,
> Isn't there some loop that allows non-sequential numbers?
No. Why would you do that?
Under some circumstance you may consider using a mapping array, e.g.
Dim arr() As Long
Dim i As Long
Dim n As Long
ReDim arr(0 To 7) As Long
arr(0) = 1
arr(1) = 2
arr(2) = 3
arr(3) = 4
arr(4) = 6
arr(5) = 8
arr(6) = 9
arr(7) = 10
For i = LBound(arr()) To UBound(arr())
n = arr(i)
'...
Next i
mfG
--> stefan <--
Paolo - 13 May 2008 16:04 GMT
Hi Bill,
I dunno if exist a loop of the kind you said but you can do that
for n=0 to 10
your code
if n=4 then
n=5 'placing five in n before the next n statement allow you to
skip this value 'cause the next n add 1 to n and so n will be 6
endif
next n
HTH Paolo
> Isn't there some loop that allows non-sequential numbers? I thought I had
> come across or actually used something like:
[quoted text clipped - 4 lines]
>
> Any suggestions?
ragtopcaddy - 20 May 2008 17:24 GMT
Thanks to all for your suggestions. I'm going with Paolo's as it's the
simplest.
The reason I'd like to do something like this is for simplicity. I'd prefer
to avoid arrays and custom functions unless absolutely necessary.
Thanks,
>Hi Bill,
>I dunno if exist a loop of the kind you said but you can do that
[quoted text clipped - 14 lines]
>>
>> Any suggestions?

Signature
Bill Reed
"If you can't laugh at yourself, laugh at somebody else"