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: 144
Default Issue with code execution -- it is very slow

Hi all,

I have a major issue right now with the time it is taking for two queries to
execute. This is actually realated to an issue I posted a couple of days ago
("Issue with refreshing pivot tables in my code" posted on 6/4/07).
Regarding the more recent issue, the code below takes over 10 minutes (at
least) to execute -- I always just kill the query after a period of time. It
doesn't make sense to me as to why it would take this long.

This is very concerning because the end product will have significantly more
data than what I am using for testing (there are 5997 records on the "Member
ID Report Master" sheet and only 3 records on the "Payment Sales Master"
sheet currently).

Does anyone have any idea as to why it would take Excel so long to execute
this query??? Might it have something to do with the fact that I had pivot
tables originally in this file that I was refreshing via the code? FYI - I
decided to get rid of the pivot tables (they are now deleted from the file)
and essentially replicate the functionality of the pivot table through the
code with the thought that the time to execute the query would decrease
signficantly by not using pivot tables. I've found that this has not been
the case... for more info on my issue with the pivot tables, please see my
post titled "Issue with refreshing pivot tables in my code" posted on 6/4/07
-- FYI -- I have not received a response to that post).


Sub opentransids()

Dim uniqueidsopen As Range
Dim F 'individual record within "uniqueidsopen" range
Dim payclosed As Range
Dim G 'individual record within "payclosed" range
Dim x 'variable to determine how many rows down to input uniqueidsopen
Dim c 'variable to determine whether or not a uniqueidsopen is also within
opentrans

With Sheets("Unique Member IDs")
If Len(.Range("A3")) < 0 Then
Set uniqueidsopen = .Range("A2", .Range("A2").End(xlDown))
Else
Set uniqueidsopen = .Range("A2")
End If
End With

With Sheets("Payment Sales Master")
If Len(.Range("H3")) < 0 Then
Set payclosed = .Range("H2", .Range("H2").End(xlDown))
Else
Set payclosed = .Range("H2")
End If
End With

x = 1
For Each F In uniqueidsopen
c = 0
For Each G In payclosed
If F = G Then
c = c + 1
Else
End If
Next

If c = 0 Then
With Sheets("Open Transactions")
.Range("D1").Offset(x, 0).value = F
x = x + 1
End With
Else
End If
Next

End Sub



Thanks!
--
Robert
 
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
Very slow Visual Basic code execution in new Excel 2007 JLatham Excel Programming 6 October 7th 09 09:45 PM
Execution very slow jimmy[_5_] Excel Programming 4 March 4th 07 09:04 PM
Slow code execution side_ Excel Programming 2 October 21st 05 06:44 PM
Excel to Powerpoint Slow Execution Francis de Brienne Excel Programming 6 September 3rd 04 08:59 PM
slow macro execution Vasile Dumitrescu Excel Programming 1 October 7th 03 03:31 PM


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

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"