Thread: Filter Macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
DnD DnD is offline
external usenet poster
 
Posts: 3
Default Filter Macro

Sub macFilterScorecard()
€˜Employee Score Card Filter Macro
€˜Employee scorecard, Filter a range of data to eliminate the values "0", "No
data", and "No ranking"


Range("$B$4:$C$172.AutoFilter Field:=2, Criteria1:="<0", Operator:=xlAnd,
Criteria2:="<*N*"
End Sub

Of course this won't filter blank cells nor will it filter score card values
that display an error (#value, etc) as a result of a formmula.

For that you might try:

Range("B4:C172").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("B1:C3"), Unique:=False

Where the values in B1 & C1 are the Column Headers that are in B4 & C4, and
C2 = 1, C2 = <1, C3 = 1


"thefonz37" wrote:

I'm building an employee scorecard, but I want to filter by only the relevant
results, so I want to place a filter on a range of data to eliminate the
values "0", "No data", and "No ranking".

When I tried to record the macro, I instead came up with the following code,
which didn't filter out the above 3 values, instead filtered FOR the
remaining values (which are subject to change, depending on a number of
things). Is there any way to correct this?

Sub macFilterScorecard()
'
' macFilterScorecard Macro
'

'
ActiveSheet.Range("$B$4:$C$172").AutoFilter Field:=2, Criteria1:=Array( _
"0.25", "0.65", "1", "104.00", "129", "137.38%", "5.29%", "5.50",
"7,778", "79.69", "98", _
"98.50"), Operator:=xlFilterValues
End Sub