Thread: Filtering Data
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tess457 tess457 is offline
external usenet poster
 
Posts: 1
Default Filtering Data

I have been trying to filter out a large database, here are the tw
approaches I have tried:
I tried filtering the data using a for loop, but with this code, i
only filters one variable at a time, it will give me all the "HR"s
then all the "CC"s, etc. I need to get the HR,CC, TA,etc all together
and not one at a time.

Dim rnData As Range
Dim vaConditions As Variant
Dim i As Long

vaConditions = VBA.Array("HR", "CC", "TA")

Application.ScreenUpdating = False

With ActiveSheet
For i = 0 To 2
Set rnData = .UsedRange
With rnData
.AutoFilter Field:=3, Criteria1:=vaConditions(i)
'.Offset(1, 0).Resize(.Rows.count - 1, .Columns.count
_
'.SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
.AutoFilterMode = False
.UsedRange
Next i
End With

Application.ScreenUpdating = True

I have also tried using the advanced autofilter feature, but I canno
get it to work properly, I have tried it with elementary data values
and it works, but when I try to apply it to my data, it doesnt filte
anything out.

Columns("C:C").AdvancedFilter Action:=xlFilterInPlace
CriteriaRange:=Range("F2:F6"), Unique:=False

I have included a sample of the database that I am working with.....
would appreciate any help or suggestions that you may have!!! I than
you in advance for your consideration.

Dusti

Attachment filename: test.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=69698
--
Message posted from http://www.ExcelForum.com