View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] terryspencer2003@yahoo.ca is offline
external usenet poster
 
Posts: 32
Default For Next Looping (custom variables)

I often use For Next Loops to loop through routines:

For X = 1 to 10

I know that you can also step through the loop based on a constraint:

For X = 1 to 10, Step 2 (you get 2 4 6 8 10)

But is it possible to set up the loop to get say (1,5,6,8,10). That
is I want to predefine the loop based on a custom order. I am
assuming that I have to read the range into some sort of array and
then give the user the option to custom pick. I imagine a userform is
needed.

And is it possible to do this with sheets in Excel. So if I have a
print macro which prints predefined sheets within a loop, can I set up
another loop which reads the number of sheets into my for Next
statement and allows me to custom pick the ones I want to print within
the greater loop? That is I pick the sheets in advance, and my macro
prints these chosen sheets with its loop.

Thanks in advance!

TS