Macro for Advance Filtering

CHuguley

New Member
Joined
Feb 17, 2002
Messages
45
I need help putting togethter a macro that uses the Advanced Filtering function. How can I go about getting it done?

Thanks for your help,
Corey
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Ekim

Well-known Member
Joined
Jun 30, 2002
Messages
1,416
Sub FilterData()
'
' FilterData Macro
' Macro recorded 26/10/2002 by Mike
'
'
Range("A1:D16").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"F1:G2"), CopyToRange:=Range("F6"), Unique:=False
End Sub<HTML><HEAD><Script Langage JavaScript><!---
function CopyToClipBoard() {
var HtmlSource;
HtmlSource = document.all.ForSubmit.innerHTML;
HtmlSource=RetDeleted(HtmlSource);
window.clipboardData.setData("Text",HtmlSource);
alert('Html source of above imagennhas been copied to your clip boardnnJust paste it into Message Body');
}
function RetDeleted(targetstring) {
if (targetstring.indexOf(unescape('%0D%0A')) > -1) rcode = unescape('%0D%0A')
else if (targetstring.indexOf(unescape('%0A')) > -1) rcode = unescape('%0A')
else rcode = unescape('%0D');
i = 0;
p = '';
while (targetstring.indexOf(rcode,i) != -1) {
m = targetstring.indexOf(rcode,i);
p += targetstring.substring(i,m);
i = m + rcode.length;
}
p += targetstring.substring(i,targetstring.length);
return p;
}</Script></HEAD><BODY BGCOLOR=#E0F4EA><CENTER><FONT COLOR=#339966 SIZE=5>[HtmlMaker 2.20]</FONT></CENTER><HR><SPAN id='ForSubmit'>
Parts and Models - Autofilter.xls
ABCDEFGHIJ
1DatePartNoModelPriceDate
21-Oct-02101A19.562-Oct-02
31-Oct-02101A19.56
41-Oct-02102B22.50
51-Oct-02103C9.45FilteredList:
61-Oct-02104D14.90DatePartNoModelPrice
72-Oct-02101A19.562-Oct-02101A19.56
82-Oct-02102B22.502-Oct-02102B22.50
92-Oct-02102B22.502-Oct-02102B22.50
102-Oct-02103C9.452-Oct-02103C9.45
112-Oct-02104D14.902-Oct-02104D14.90
123-Oct-02101A19.56
133-Oct-02103C9.45
143-Oct-02102B22.50
153-Oct-02103C9.45
163-Oct-02104D14.90
17
18
Sheet1
</SPAN><CENTER><HR><FORM NAME='form1'><INPUT TYPE='Button' value='Please click this button to send the source to clipbord' onClick='CopyToClipBoard();'></FORM><FONT COLOR=#339966 SIZE=2> This free code was written by Colo and Ivan F Moala:[HtmlMaker 2.20] - 27th June 2002</FONT><FONT COLOR=#339966 SIZE=2>Code mods by Ivan F Moala - 27th June 2002</FONT></HR></BODY></HTML>

HTH

Mike
 

Ekim

Well-known Member
Joined
Jun 30, 2002
Messages
1,416
The above macro could have been written a bit better.<pre>
Sub FilterData()
'
' FilterData Macro
' Macro recorded 16/09/2002 by Mike

With Worksheets("Sheet1")
.Range("Data").AdvancedFilter _
Action:=xlFilterCopy, CriteriaRange:=Range("F1:G2"), _
CopyToRange:=Range("F6"), Unique:=False
End With

End Sub</pre>

Note that "Data" is a named range that corresponds to A1:D16.

Mike
This message was edited by Ekim on 2002-10-25 16:18
 

Forum statistics

Threads
1,144,363
Messages
5,723,919
Members
422,527
Latest member
JayTheKaz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top