LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Excel2000: code too slow

Hi

The code snippet below works too slow. It exports data from one Excel table
(Customer,CustCode, Article, January, ..., December) to new one in different
workbook (CustCode, Article, FirstWorkdayOfMonth, EntryType, CustCode). It
looks like the problem is writing data to new table - writing 12 months data
(12*5 fields) from a row in source table into new table takes ~50 sec. As
the source table has almost 2000 rows, and most of rows have values for all
12 months, it takes 10 hours to generate the new table. (The rest of code
takes next to nothing to run - the code row displaying process info on
status bar was added to check this)

At start I used offset to determine target cells, and suspected this to be
the cause. So I replaced offsets with direct references - but this had no
effect at all.

Can anyone explain me this? Thanks in advance!

....
k = 0
....
If
Workbooks(varSource).Sheets(varSheet).Range("A1"). Offset(i - 1, 1) = varCode
Then
varArticle =
Workbooks(varSource).Sheets(varSheet).Range("A1"). Offset(i - 1, 2)
For j = 1 To 12
If
Workbooks(varSource).Sheets(varSheet).Range("A1"). Offset(i - 1, j + 2) 0
Then
Application.StatusBar = "Code: " & varCode & ",
Article: " & varArticle & ", Month:" & arrMonths(j)

ThisWorkbook.Sheets("Forecast").Range("A" & (k +
1) & ":C" & (k + 1)).NumberFormat = "@"
ThisWorkbook.Sheets("Forecast").Range("D" & (k +
1) & ":E" & (k + 1)).NumberFormat = "General"
ThisWorkbook.Sheets("Forecast").Range("F" & (k +
1)).NumberFormat = "@"
ThisWorkbook.Sheets("Forecast").Range("A" & (k +
1)) = varCode
ThisWorkbook.Sheets("Forecast").Range("B" & (k +
1)) = varArticle
ThisWorkbook.Sheets("Forecast").Range("C" & (k +
1)) = arrMonths(j)
ThisWorkbook.Sheets("Forecast").Range("D" & (k +
1)) = Workbooks(varSource).Sheets(varSheet).Range("A1"). Offset(i - 1, j + 2)
ThisWorkbook.Sheets("Forecast").Range("E" & (k +
1)) = 4
ThisWorkbook.Sheets("Forecast").Range("F" & (k +
1)) = varCode
k = k + 1
End If
Next j
End If
Exit For
End If
....


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )


 
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
Slow Code Shawn Excel Programming 7 August 23rd 05 08:44 PM
"Group" function very slow with Excel 2003 :( ... While very quick with Excel2000 :O) Alain79 Excel Discussion (Misc queries) 4 June 14th 05 07:34 AM
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
Is this slow code? Tom Excel Programming 4 March 3rd 04 11:18 PM


All times are GMT +1. The time now is 02:29 AM.

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

About Us

"It's about Microsoft Excel"