View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bruce Roberson Bruce Roberson is offline
external usenet poster
 
Posts: 47
Default For Loop in Sub Detailloop

Jim:

I ended up doing away with all the subs except for the
beginning one called "Process_data"

I made all the other subs be goto areas, and then I had to
refollow the flow to make sure it finished right. I am in
the process of evaulating the file it creates against the
one in QPW for the month. Then if that worked, I have two
closing lines to put in, then to export it to txt which
should be a piece of cake compared to all this other mess.

I've been in Excel 2000 now for going on two months, and
so far, I still say Excel is not nearly as easy or user
friendly to use as Quattro Pro is. Maybe over time my
ideas will change. But right now, if it weren't for the
guys in this newgroup, I would of already given up trying
to program VBA at all.

Once I clean up all the ugly code that I know to clean up,
I'll post back here my best effort to date to get final
suggestions on making it look prettier. Right now, I'm
going to finish the functionality part.

Thanks for your help.


Bruce

-----Original Message-----
Bruce-

Don't let this go to your head, but this code is the 97

pound weakling to
Charles Atlas. I'm sure it does something quite simple

if only I could
understand it. Your biggest problem is that you have

unintended circular
calls (I think). HeaderRecord2 calls DetailLoop which

calls summonth which
calls HeaderRecord2. This is circular and will never

resolve except by a
macro error. You must restructure this and I'd bet that

that restructuring
would require the elimination of summonth's call to

HeaderRecord2. At some
point, in any case, some sub has to just return without

calling anything.

I don't know what you're doing with i. Nothing within

the loop seems to
vary with different i's so it seems to be doing the same

thing time after
time.

Btw, code like:

ActiveCell.Offset(0, 0).Value = Range("Sum_it").Offset(0,

0)
ActiveCell.Offset(1, 0).Value = Range("Sum_it").Offset(1,

0)
ActiveCell.Offset(2, 0).Value = Range("Sum_it").Offset(2,

0)
....
ActiveCell.Offset(7, 0).Value = Range("Sum_it").Offset(7,

0)


can be made a one-liner:

ActiveCell.Resize(7).Value = Range("Sum_it").Resize

(7).Value


--
Jim Rech
Excel MVP


.