Alternative to using .Select for cursor movement.
Bob:
I think I see what you're saying about the cells method. The formulas listed below were just off the wall examples. The 9* whatever was in no way a pattern in these first examples.
activecell.offset(1,0).formula = "=9*1"
activecell.offset(2,0).formula = "=9*2"
activecell.offset(3,0).formula = "=9*3"
I think the real deal with your cells method will go something like the example below. Notice that there is a combination of character expressions mixed in with references to spreadsheet ranges and indexes. So I guess I'll have to see if screenupdating may be necessary in this case to get those spreadsheet range values. But I guess what you're saying in your post is this Cells method is preferable to using the "activecell.offset(X,Y).formula =" approach?
activecell.offset(1,0).formula = "=FGS~FEE"
activecell.offset(2,0).formula = "=N1~PP~~75~0000000"
activecell.offset(3,0).formula = "=N1~C7~~75~000"
As opposed to the real world example here should go something like what is written below:
Application,.Screenupdating = False
For i = 1 To cRows ' will determine how many records to process by a crows approach
Cells(1,0).Formula = "=FGS~FEE"
Cells(2,0).Formula = "=N1~PP~~75~0000000"
Cells(3,0).Formula = "=N1~C7~~75~000"
Cells(4,0).Formula = "=N1~SY~~49~00000000000"
Cells(5,0).Formula = "=TIA~8605~~8"
Cells(6,0).Formula = "=TIA~8020~~0"
Cells(7,0).Formula = "=TIA~8025~~0"
Cells(8,0).Formula = "=TIA~8030~~0"
Cells(9,0).Formula = "=TIA~8030~~0"
Cells(10,0).Formula = "=TIA~8056~~~"&Fixed(INDEX(Summary,2,ROWSUM),0)&"~ FM"
Cells(11,0).Formula = "=TIA~8656~"&Fixed(INDEX(Summary,2,ROWSUM)*Cleanup feerate,2)
Cells(12,0).Formula = "=TIA~8230~~~"&FIXED(INDEX(Summary,2,ROWSUM),0)&"~ FM"
Cells(13,0).Formula = "=TIA~8065~0"
Cells(14,0).Formula ="=TIA~8070~0"
Cells(15,0).Formula ="=TIA~8200~0"
i = i + 1
Next
In QPW, the ~ character was for carriage return. If it was put in a line like the ones above, and you did not want the carriage return at that position, you had to enclose it in braces as such {~}. I am presuming Excel will not be confused in any way about the meaning of the character ~ ?
Bob's example was:
Application,.Screenupdating = False
For i = 1 To 100
Cells(i,1).Formula = "G*" & i
Next
...
Application.ScreenUpdating = True
If you don't know how many rows in advance, use that code I gave you before to determine the number of rows with data, the cRows = Cells(Rows.Count ...
--
HTH
Bob Phillips
|