PC Review


Reply
Thread Tools Rate Thread

Advanced Filtering Problem

 
 
RussellT
Guest
Posts: n/a
 
      10th Dec 2009
The following code executes in about 2 seconds in excel 2003 but takes 2
mintes in excel 2007. Anyone know why? The size of the database is 50,000
row by 52 columns.

Public Sub FilterDbase_Click()
Dim filtercontrolSheet As Worksheet
Dim resultsSheet As Worksheet
Set filtercontrolSheet = Sheets("FilterControl")
Set resultsSheet = Sheets("Results")
Application.ScreenUpdating = False
resultsSheet.Activate
resultsSheet.Range("A10:IV65536").Select
Selection.ClearContents

'Perform Extract
Dim SourceRng As Range
Dim CritRng As Range
Dim CopyToRng As Range
filtercontrolSheet.Activate
filtercontrolSheet.Range("Criterion1").Select
Selection.ClearContents
filtercontrolSheet.Range("Criterion2").Select
Selection.Copy
filtercontrolSheet.Range("A29").Select
ActiveSheet.Paste

Set SourceRng = Sheets("PlanData").Range("SourcePlan")
Set CritRng = Sheets("FilterControl").Range("A28:AV29")
Set CopyToRng = Sheets("Results").Range("A10:AQ10")
filtercontrolSheet.Range("PlanHeader").Select
Selection.Copy
resultsSheet.Activate
resultsSheet.Range("A10").Select
ActiveSheet.Paste
SourceRng.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=CritRng,
CopyToRange:=CopyToRng, Unique:=False
End Sub
 
Reply With Quote
 
 
 
 
Lionel H
Guest
Posts: n/a
 
      11th Dec 2009
Hi Russell,
1. I don't have XL2007 yet so can't "play" with your routine, but I have
heard that the max dimensions of a spreadsheet have changed. So the line:
resultsSheet.Range("A10:IV65536").Select
could cause you a problem if your database grows from ~50000 to > 65535 rows.

2. Have you tried stepping through the routine to try to pinpoint more
precicely where the extra time is being spent?



"RussellT" wrote:

> The following code executes in about 2 seconds in excel 2003 but takes 2
> mintes in excel 2007. Anyone know why? The size of the database is 50,000
> row by 52 columns.
>
> Public Sub FilterDbase_Click()
> Dim filtercontrolSheet As Worksheet
> Dim resultsSheet As Worksheet
> Set filtercontrolSheet = Sheets("FilterControl")
> Set resultsSheet = Sheets("Results")
> Application.ScreenUpdating = False
> resultsSheet.Activate
> resultsSheet.Range("A10:IV65536").Select
> Selection.ClearContents
>
> 'Perform Extract
> Dim SourceRng As Range
> Dim CritRng As Range
> Dim CopyToRng As Range
> filtercontrolSheet.Activate
> filtercontrolSheet.Range("Criterion1").Select
> Selection.ClearContents
> filtercontrolSheet.Range("Criterion2").Select
> Selection.Copy
> filtercontrolSheet.Range("A29").Select
> ActiveSheet.Paste
>
> Set SourceRng = Sheets("PlanData").Range("SourcePlan")
> Set CritRng = Sheets("FilterControl").Range("A28:AV29")
> Set CopyToRng = Sheets("Results").Range("A10:AQ10")
> filtercontrolSheet.Range("PlanHeader").Select
> Selection.Copy
> resultsSheet.Activate
> resultsSheet.Range("A10").Select
> ActiveSheet.Paste
> SourceRng.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=CritRng,
> CopyToRange:=CopyToRng, Unique:=False
> End Sub

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Filtering Kirk P. Microsoft Excel Misc 2 19th Nov 2009 05:26 PM
Advanced Filtering problem george-smith@work.com Microsoft Excel Programming 1 25th May 2006 04:05 AM
Advanced Filtering Stephen Microsoft Excel Discussion 1 28th Jun 2005 02:55 PM
Advanced Filtering spence Microsoft Excel Misc 2 21st Jan 2004 01:00 AM
Advanced Filtering Problem trebor Microsoft Excel Misc 1 13th Nov 2003 11:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:24 AM.