View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] donna.gough@hydro.com is offline
external usenet poster
 
Posts: 81
Default How To Loop From File0001.xls To File0150.xls

Using....
For j = 1 To 101
FileToOpen = "File000" & j & ".xls"
......
This obviously fails when it tries to open File0010.xls.
Can you loop with it recognising the preceeding 0's in the number ?
I know you can use the length of j to then alter the number of 0's
after the File component by using if/elseifs or case select etc but I'm
sure there must be a way of looping from 0001 to 0010 to 0150.

Question is ...is there ?

Kind Regards
Donna