Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Better Way To Do This SLOW code [email protected] Excel Programming 1 January 27th 06 08:24 AM
Slow Code Shawn Excel Programming 7 August 23rd 05 08:44 PM
SLOW Code... Ernst Guckel[_4_] Excel Programming 2 March 20th 05 10:58 AM
Slow Code Frank Kabel Excel Programming 1 July 23rd 04 09:28 AM
Finish one section of code before continuing graham Excel Programming 3 July 18th 04 04:17 PM


All times are GMT +1. The time now is 10:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"