View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ALEX ALEX is offline
external usenet poster
 
Posts: 493
Default Simple question on For...Next loop

Hello.

This should be easy for the pros of the list

I am used to writing For...Next loops as...

For i = 1 to 10

.... and sometimes using the Step 2 to not move up by increments of 1.

How do I use the loop structure for an eclectic bunch of numbers e.g.

1,2, 5,7, 12, 15,20

So for example I tried

For col = 1, 2, 5, 7, 12, 15, 20

....but VBA said 'no'.

I managed to do this by forming an array...but I am sure there is an easier
route.

Regards


Alex