455,097 Members | 1,252 Online
Need help? Post your question and get tips & solutions from a community of 455,097 IT Pros & Developers. It's quick & easy.

# Looping Question

 P: 28 Hello all! I would like some help with the code below. I would like to write the following using a for loop. Can anyone help? frmResult.flgPrint.set_ColWidth(0, 2800) frmResult.flgPrint.set_ColWidth(2, 2800) frmResult.flgPrint.set_ColWidth(4, 2800) frmResult.flgPrint.set_ColWidth(6, 2800) frmResult.flgPrint.set_ColWidth(8, 2800) Thanks Mar 31 '07 #1
5 Replies

 Expert 100+ P: 1,356 You didn't provide a lot of information here, but I will try to assist: Expand|Select|Wrap|Line Numbers Do until Cnt = 2000 frmResult.flgPrint.set_ColWidth(Cnt, 2800) Cnt = Cnt+2 loop Mar 31 '07 #2

 Expert 5K+ P: 8,434 Since you wanted a FOR loop, try this... Expand|Select|Wrap|Line Numbers Dim I As Long For I = 0 To 8 Step 2   frmResult.flgPrint.set_ColWidth(I, 2800) Next Apr 1 '07 #3

 Expert 100+ P: 1,356 Thank you Killer, I guess I need to be a bit more thorough when reading. :) Apr 1 '07 #4

 100+ P: 579 Since you wanted a FOR loop, try this... Expand|Select|Wrap|Line Numbers Dim I As Long For I = 0 To 8 Step 2   frmResult.flgPrint.set_ColWidth(I, 2800) Next for such a small loop use byte insted of long or u may try inline defination also (just for memory cunsumption purpose) take it easy Apr 2 '07 #5

 Expert 5K+ P: 8,434 for such a small loop use byte insted of long or u may try inline defination also (just for memory consumption purpose) take it easy True, a Long uses three bytes more than a Byte variable. However, I always try to use Long wherever possible for performance reasons, as it's the native data type on a 32 bit processor. It's really just a matter of personal preference, I suppose. Apr 2 '07 #6