PC Review


Reply
Thread Tools Rate Thread

Convert Advanced filter macro to VBA

 
 
ScoobyDoo
Guest
Posts: n/a
 
      19th Jul 2008
Hi

I have this macro to filter data


Sheets("Working Data").Select
Cells.Select
Selection.Delete Shift:=xlUp
Range("A1").Select
Sheets("Raw data").Cells.AdvancedFilter Action:=xlFilterCopy,
CriteriaRange _
:=Sheets("Filter Criteria").Rows("1:3"),
CopyToRange:=Range("A1"), Unique _
:=False
Cells.Select
Selection.Columns.AutoFit


The filter Criteria is on sheet Filter Criteria
There are row headings from Columns A to AG
The actual criteria are;

Cell D2 ="=*AoS"
Cell F3 ="=*AoS"

Cell I2 ="=*Battle"
Cell I3 ="=*Battle"

Cell L2 ="=USA"
Cell L3 ="=USA"

Cell M2 ="=*Victory"
Cell M3 ="=*Victory"

The data being filtered is on sheet Raw Data
Once the data is filtered, it is copied top sheet Working data

I have read in various threads that VBA code can be more efficient
than Macro code. My questions is..

how do you convert the above code to VBA?
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      19th Jul 2008
I believe the references you are refereing to is to use VB6 compiler to
compile the code. To compile code you need to buy a compiler. Compiled code
can sometimes run faster and may take up less memory that an excel macro.

The question is why do you want to convert. does the present code take a
long time to run? Compiled code only real advantage besides speed is you
don't need to buy Excel (MicroSoft Office) to run the code. Compiled code
just requires Windows installed on the PC or servier.

"ScoobyDoo" wrote:

> Hi
>
> I have this macro to filter data
>
>
> Sheets("Working Data").Select
> Cells.Select
> Selection.Delete Shift:=xlUp
> Range("A1").Select
> Sheets("Raw data").Cells.AdvancedFilter Action:=xlFilterCopy,
> CriteriaRange _
> :=Sheets("Filter Criteria").Rows("1:3"),
> CopyToRange:=Range("A1"), Unique _
> :=False
> Cells.Select
> Selection.Columns.AutoFit
>
>
> The filter Criteria is on sheet Filter Criteria
> There are row headings from Columns A to AG
> The actual criteria are;
>
> Cell D2 ="=*AoS"
> Cell F3 ="=*AoS"
>
> Cell I2 ="=*Battle"
> Cell I3 ="=*Battle"
>
> Cell L2 ="=USA"
> Cell L3 ="=USA"
>
> Cell M2 ="=*Victory"
> Cell M3 ="=*Victory"
>
> The data being filtered is on sheet Raw Data
> Once the data is filtered, it is copied top sheet Working data
>
> I have read in various threads that VBA code can be more efficient
> than Macro code. My questions is..
>
> how do you convert the above code to VBA?
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      20th Jul 2008
Macro code is VBA.

If you are really meaning VB6 as suggested, there is a lot more work, and
there is the overhead of automation, connecting VB6 to Excel.

You would be better explaining what your problem is and solving it using
VBA. For instance, not selecting helps speed things, turning screen off,
etc.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ScoobyDoo" <(E-Mail Removed)> wrote in message
news:b4551e82-9844-46cc-847a-(E-Mail Removed)...
> Hi
>
> I have this macro to filter data
>
>
> Sheets("Working Data").Select
> Cells.Select
> Selection.Delete Shift:=xlUp
> Range("A1").Select
> Sheets("Raw data").Cells.AdvancedFilter Action:=xlFilterCopy,
> CriteriaRange _
> :=Sheets("Filter Criteria").Rows("1:3"),
> CopyToRange:=Range("A1"), Unique _
> :=False
> Cells.Select
> Selection.Columns.AutoFit
>
>
> The filter Criteria is on sheet Filter Criteria
> There are row headings from Columns A to AG
> The actual criteria are;
>
> Cell D2 ="=*AoS"
> Cell F3 ="=*AoS"
>
> Cell I2 ="=*Battle"
> Cell I3 ="=*Battle"
>
> Cell L2 ="=USA"
> Cell L3 ="=USA"
>
> Cell M2 ="=*Victory"
> Cell M3 ="=*Victory"
>
> The data being filtered is on sheet Raw Data
> Once the data is filtered, it is copied top sheet Working data
>
> I have read in various threads that VBA code can be more efficient
> than Macro code. My questions is..
>
> how do you convert the above code to VBA?



 
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
Problem with advanced filter macro DavidH56 Microsoft Excel Programming 8 3rd Jun 2009 12:24 AM
Advanced filter macro Boss Microsoft Excel Programming 3 11th Dec 2008 09:31 AM
Advanced Filter Macro Alex.W Microsoft Excel Misc 1 4th Apr 2008 12:19 PM
Advanced Filter Macro Dolphinv4 Microsoft Excel Misc 2 20th Mar 2008 11:42 AM
Using Advanced Filter through Macro =?Utf-8?B?UHJhc2hhbnQgR2FyZw==?= Microsoft Excel Programming 4 18th Dec 2004 01:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:36 AM.