Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Filtering one column based on multiple arguements

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt - 25 Jul 2006 22:59 GMT
I want to filter my spread sheet with a macro based on the information
in one column, the catch is that I'd like to hide anything that is one
of 5 different entries.  From my initial testing I concluded that Excel
might not support more than 2 arguements per column in a filter.  This
is a problem as I have thousands of entries with about 15 different
codes, but 5 of the codes are different ways of saying that something
didn't happen (each for a different reason which is important,
otherwise I could just use find/replace to code them all the same) I
want to view only the rows containing entries that did happen using a
filter, but the only way I have to do this is to write a macro that
checks each entry in the column to determine if it was one of these
codes and then hides them, stepping through a loop as it goes.

Here is what I've written for that piece:

Sub Operational()
Dim ColOTP As Integer
ColOTP = 7
For i = 2 To Worksheets("Data").UsedRange.Rows.Count
   With Worksheets("Data").Cells(i, ColOTP)
       If .Value = "Cancelled" Or _
           .Value = "Weather" Or _
           .Value = "Mechanical" Or _
           .Value = "None" Or _
           .Value = "Not Initialized" Then
               Worksheets("Data").Rows(i).EntireRow.Hidden = True
       End If
   End With
Next i
End Sub

While this is functional as itself, it is not functional if I apply
this and then try to filter based on a quality of something in a
different column, doing so unhides all the entries that were hidden via
the above macro that meet the quality of the filter.
Franz Verga - 26 Jul 2006 10:25 GMT
> I want to filter my spread sheet with a macro based on the information
> in one column, the catch is that I'd like to hide anything that is one
[quoted text clipped - 9 lines]
> one of these codes and then hides them, stepping through a loop as it
> goes.

Hi Matt,

I think you could try to use Advanced Filter instead of Automatic Filter.
With Advanced Filter you can specify as many you want criteria to filter
your table...

Signature

Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.