Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Really slow code (just this one section)
I pull data into an array and perform several calculations; now I just need
to dump it back into my spreadsheet. For some reason, the code below is taking 3-4 seconds per loop (of v); each loop only has to paste 8 values in 8 cells! The rest of the code runs very, very fast, it is only this section of code that is so slow. Any suggestions on why it might be slow, and how to speed it up? Thanks, Keith XL2003 on Win2000 <snip For v = 1 To LastOut 'about 3000+ rows vt = Trim(Str(v)) 'do this conversion once, instead of with each range assignment Application.StatusBar = "Pasting row " & vt & " of " & Str(LastOut) 'this is so I know how fast it is[n't] going For PasteCol = 17 To 20 UsePasteCol = Chr(PasteCol + 64) Sheet3.Range(UsePasteCol & vt).Value = OutArr(PasteCol, v) Next For PasteCol = 23 To 26 UsePasteCol = Chr(PasteCol + 64) Sheet3.Range(UsePasteCol & vt).Value = OutArr(PasteCol, v) Next Next <snip -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Really slow code (just this one section)
Is your calculation enabled while this code is running. if it is having to
re-calc with each loop that could account for the significant time... -- HTH... Jim Thomlinson "KR" wrote: I pull data into an array and perform several calculations; now I just need to dump it back into my spreadsheet. For some reason, the code below is taking 3-4 seconds per loop (of v); each loop only has to paste 8 values in 8 cells! The rest of the code runs very, very fast, it is only this section of code that is so slow. Any suggestions on why it might be slow, and how to speed it up? Thanks, Keith XL2003 on Win2000 <snip For v = 1 To LastOut 'about 3000+ rows vt = Trim(Str(v)) 'do this conversion once, instead of with each range assignment Application.StatusBar = "Pasting row " & vt & " of " & Str(LastOut) 'this is so I know how fast it is[n't] going For PasteCol = 17 To 20 UsePasteCol = Chr(PasteCol + 64) Sheet3.Range(UsePasteCol & vt).Value = OutArr(PasteCol, v) Next For PasteCol = 23 To 26 UsePasteCol = Chr(PasteCol + 64) Sheet3.Range(UsePasteCol & vt).Value = OutArr(PasteCol, v) Next Next <snip -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Really slow code (just this one section)
Ah, good point- I hadn't added any formulas of note, but now that I've
turned off calculation, it is running at full speed- one of the other other users must have added some. Thanks!! Keith "Jim Thomlinson" wrote in message ... Is your calculation enabled while this code is running. if it is having to re-calc with each loop that could account for the significant time... -- HTH... Jim Thomlinson "KR" wrote: I pull data into an array and perform several calculations; now I just need to dump it back into my spreadsheet. For some reason, the code below is taking 3-4 seconds per loop (of v); each loop only has to paste 8 values in 8 cells! The rest of the code runs very, very fast, it is only this section of code that is so slow. Any suggestions on why it might be slow, and how to speed it up? Thanks, Keith XL2003 on Win2000 <snip For v = 1 To LastOut 'about 3000+ rows vt = Trim(Str(v)) 'do this conversion once, instead of with each range assignment Application.StatusBar = "Pasting row " & vt & " of " & Str(LastOut) 'this is so I know how fast it is[n't] going For PasteCol = 17 To 20 UsePasteCol = Chr(PasteCol + 64) Sheet3.Range(UsePasteCol & vt).Value = OutArr(PasteCol, v) Next For PasteCol = 23 To 26 UsePasteCol = Chr(PasteCol + 64) Sheet3.Range(UsePasteCol & vt).Value = OutArr(PasteCol, v) Next Next <snip -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Better Way To Do This SLOW code | Excel Programming | |||
Slow Code | Excel Programming | |||
SLOW Code... | Excel Programming | |||
Slow Code | Excel Programming | |||
Finish one section of code before continuing | Excel Programming |