Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How To Loop From File0001.xls To File0150.xls
For j = 1 To 11
a = "File" + "0000" b = Left(a, Len(a) - Len(j)) & j Next j This works. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How To Loop From File0001.xls To File0150.xls
Hi Donna
FileToOpen = "File" & Format(j, "0000") & ".xls" HTH. Best wishes Harald skrev i melding oups.com... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How To Loop From File0001.xls To File0150.xls
Thank you very much....you've saved me a lot of trouble.
|
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How To Loop From File0001.xls To File0150.xls
skrev i melding
oups.com... Thank you very much....you've saved me a lot of trouble. Glad to hear that. Thank you for the feedback. Best wishes Harald |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find loop doesn't loop | Excel Discussion (Misc queries) | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
How do I create a For loop within a For loop? | Excel Programming | |||
Worksheet_Change - loop within a loop | Excel Programming | |||
HELP!!!! Can't stop a loop (NOT an infinite loop) | Excel Programming |