PC Review


Reply
Thread Tools Rate Thread

AutoFilter or something like it

 
 
pgarcia
Guest
Posts: n/a
 
      9th Jul 2008
Shouldn't this work? This is part of a greater VB code. I will post it after
this one.

Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
Criteria2:="=MTY", Operator:=xlOr, Criteria3:="=QRO",
Operator:=xlOr, _
Criteria4:="=SLW"
 
Reply With Quote
 
 
 
 
pgarcia
Guest
Posts: n/a
 
      9th Jul 2008
Sub A_1600()

Dim LastRow As Long

Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
Criteria2:="=MTY", Criteria3:="=QRO", Operator:=xlOr,_
Criteria4:="=SLW"
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Range("A1").Select
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select
Rows("1:1").Select
Selection.ClearContents
Columns("I:N").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveCell.FormulaR1C1 = "ORG"
Range("B1").Select
ActiveCell.FormulaR1C1 = "DSTN"
Range("C1").Select
ActiveCell.FormulaR1C1 = "BAX P O/N"
Range("D1").Select
ActiveCell.FormulaR1C1 = "227 kgs"
Range("E1").Select
ActiveCell.FormulaR1C1 = "454 kgs"
Range("F1").Select
ActiveCell.FormulaR1C1 = "BAX O/N"
Range("G1").Select
ActiveCell.FormulaR1C1 = "227 kgs"
Range("H1").Select
ActiveCell.FormulaR1C1 = "454 kgs"
Range("I1").Select
Selection.NumberFormat = "0.00"
ActiveCell.FormulaR1C1 = "BAX 2 Day"
Range("J1").Select
Selection.NumberFormat = "0.00"
ActiveCell.FormulaR1C1 = "227 kgs"
Range("K1").Select
Selection.NumberFormat = "0.00"
ActiveCell.FormulaR1C1 = "454 kgs"
Range("L1").Select
Selection.NumberFormat = "0.00"
ActiveCell.FormulaR1C1 = "BAX Ground"
Range("M1").Select
Selection.NumberFormat = "0.00"
ActiveCell.FormulaR1C1 = "227 kgs"
Range("N1").Select
Selection.NumberFormat = "0.00"
ActiveCell.FormulaR1C1 = "454 kgs"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Font.ColorIndex = 2
With Selection.Interior
.ColorIndex = 55
.Pattern = xlSolid
End With
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With

With ActiveSheet
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
.Rows(LastRow + 1 & ":" & .Rows.Count).Delete
End With

Range("O2").Select
ActiveCell.FormulaR1C1 = "2.2046"
Range("O3").Select
ActiveCell.FormulaR1C1 = "100"
Range("O2").Select
Selection.Copy
Range("C:H", Range("C:H").End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlMultiply,
SkipBlanks _
:=False, Transpose:=False
Range("O3").Select
Selection.Copy
Range("C:H", Range("C:H").End(xlDown)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlDivide, SkipBlanks _
:=False, Transpose:=False
Range("C:H", Range("C:H").End(xlDown)).Select
Selection.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(*
""-""??_);_(@_)"

With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Rows(LastRow + 1 & ":" & .Rows.Count).Delete
End With

Columns("O:O").Select
Selection.Delete Shift:=xlToLeft

Range("A2").Select
End Sub

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      9th Jul 2008
Hi pgarcia

The max = 2 criteria with AutoFilter
You can use advancedfilter with your criteria in a range

What do you want to do with the filter result



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"pgarcia" <(E-Mail Removed)> wrote in message news:231C826B-1AAE-419B-8AEB-(E-Mail Removed)...
> Shouldn't this work? This is part of a greater VB code. I will post it after
> this one.
>
> Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
> Criteria2:="=MTY", Operator:=xlOr, Criteria3:="=QRO",
> Operator:=xlOr, _
> Criteria4:="=SLW"

 
Reply With Quote
 
pgarcia
Guest
Posts: n/a
 
      9th Jul 2008
Thanks again. Take a look at my 2nd posting and you'll see I what I'm up to.

"Ron de Bruin" wrote:

> Hi pgarcia
>
> The max = 2 criteria with AutoFilter
> You can use advancedfilter with your criteria in a range
>
> What do you want to do with the filter result
>
>
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "pgarcia" <(E-Mail Removed)> wrote in message news:231C826B-1AAE-419B-8AEB-(E-Mail Removed)...
> > Shouldn't this work? This is part of a greater VB code. I will post it after
> > this one.
> >
> > Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
> > Criteria2:="=MTY", Operator:=xlOr, Criteria3:="=QRO",
> > Operator:=xlOr, _
> > Criteria4:="=SLW"

>

 
Reply With Quote
 
Skinman
Guest
Posts: n/a
 
      10th Jul 2008
Try this without all the = after "

Selection.AutoFilter Field:=2, Criteria1:="GDL", Operator:=xlOr, _
> Criteria2:="MTY", Operator:=xlOr, Criteria3:="QRO",
> Operator:=xlOr, _
> Criteria4:="SLW"



"pgarcia" <(E-Mail Removed)> wrote in message
news:231C826B-1AAE-419B-8AEB-(E-Mail Removed)...
> Shouldn't this work? This is part of a greater VB code. I will post it
> after
> this one.
>
> Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
> Criteria2:="=MTY", Operator:=xlOr, Criteria3:="=QRO",
> Operator:=xlOr, _
> Criteria4:="=SLW"


 
Reply With Quote
 
Skinman
Guest
Posts: n/a
 
      10th Jul 2008
More than two, you will need to enter as an array :-

Selection.AutoFilter Field:=11, Criteria1:=Array( _
"GDL", "MTY", "QRO", "SLW"), Operator:=xlFilterValues


"pgarcia" <(E-Mail Removed)> wrote in message
news:231C826B-1AAE-419B-8AEB-(E-Mail Removed)...
> Shouldn't this work? This is part of a greater VB code. I will post it
> after
> this one.
>
> Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
> Criteria2:="=MTY", Operator:=xlOr, Criteria3:="=QRO",
> Operator:=xlOr, _
> Criteria4:="=SLW"


 
Reply With Quote
 
Skinman
Guest
Posts: n/a
 
      10th Jul 2008
Should read Field 2 not 11
Selection.AutoFilter Field:=2, Criteria1:=Array( _
> "GDL", "MTY", "QRO", "SLW"), Operator:=xlFilterValues


> More than two, you will need to enter as an array :-
>
> Selection.AutoFilter Field:=11, Criteria1:=Array( _
> "GDL", "MTY", "QRO", "SLW"), Operator:=xlFilterValues
>
>
> "pgarcia" <(E-Mail Removed)> wrote in message
> news:231C826B-1AAE-419B-8AEB-(E-Mail Removed)...
>> Shouldn't this work? This is part of a greater VB code. I will post it
>> after
>> this one.
>>
>> Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
>> Criteria2:="=MTY", Operator:=xlOr, Criteria3:="=QRO",
>> Operator:=xlOr, _
>> Criteria4:="=SLW"

>

 
Reply With Quote
 
pgarcia
Guest
Posts: n/a
 
      10th Jul 2008
Thanks, I used the Advanced Filter and that did the trick.

"Ron de Bruin" wrote:

> Hi pgarcia
>
> The max = 2 criteria with AutoFilter
> You can use advancedfilter with your criteria in a range
>
> What do you want to do with the filter result
>
>
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "pgarcia" <(E-Mail Removed)> wrote in message news:231C826B-1AAE-419B-8AEB-(E-Mail Removed)...
> > Shouldn't this work? This is part of a greater VB code. I will post it after
> > this one.
> >
> > Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
> > Criteria2:="=MTY", Operator:=xlOr, Criteria3:="=QRO",
> > Operator:=xlOr, _
> > Criteria4:="=SLW"

>

 
Reply With Quote
 
pgarcia
Guest
Posts: n/a
 
      10th Jul 2008
Thanks, I used the Advanced Filter and that did the trick.

"Skinman" wrote:

> Should read Field 2 not 11
> Selection.AutoFilter Field:=2, Criteria1:=Array( _
> > "GDL", "MTY", "QRO", "SLW"), Operator:=xlFilterValues

>
> > More than two, you will need to enter as an array :-
> >
> > Selection.AutoFilter Field:=11, Criteria1:=Array( _
> > "GDL", "MTY", "QRO", "SLW"), Operator:=xlFilterValues
> >
> >
> > "pgarcia" <(E-Mail Removed)> wrote in message
> > news:231C826B-1AAE-419B-8AEB-(E-Mail Removed)...
> >> Shouldn't this work? This is part of a greater VB code. I will post it
> >> after
> >> this one.
> >>
> >> Selection.AutoFilter Field:=2, Criteria1:="=GDL", Operator:=xlOr, _
> >> Criteria2:="=MTY", Operator:=xlOr, Criteria3:="=QRO",
> >> Operator:=xlOr, _
> >> Criteria4:="=SLW"

> >

>

 
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
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Microsoft Excel Misc 1 19th Apr 2010 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Microsoft Excel Misc 3 19th Apr 2010 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Microsoft Excel Misc 1 19th Apr 2010 05:53 PM
2007 Autofilter worse than 2003 Autofilter =?Utf-8?B?anNreQ==?= Microsoft Excel Misc 9 31st Oct 2007 12:14 AM
How to Sort within AutoFilter with Protection on (and AutoFilter . =?Utf-8?B?Z2libG9u?= Microsoft Excel Misc 1 16th Feb 2006 12:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:46 AM.