View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JW[_2_] JW[_2_] is offline
external usenet poster
 
Posts: 638
Default Filter Problem - show column difference

How about just hiding the rows where J and K don't match? Would that
work?
Untested.
sub tester()
Dim cl as Range
Dim rng as Range
Set rng=range("J2:J633")
For Each cl In rng
If cl.Value=cl.Offset(0,1).Value Then cl.EntireRow.Hidden+True
Next cl
Set rng=Nothing
End Sub

If course, it would be best to set the range programatically just in
case it chages. You would also probably want to set all rows to
hidden=false before hiding any rows.

HTH


wrote:
Hi, I wonder if anyone could help with this, preferably
programmatically. I am a newbie to Filters so step by step would be
nice....

I have two columns (J and K), in which the same row may show the same
or different (text) value, depending on complex calcs elsewhere in the
sheet. J and K already have a manual autofilter set up. The rows run
from J2 to K633, with the first row showing the category name.

What I want is, a programmed filter which shows only those rows where
the column J and K values are different....

Preferably in code, so I can attach it to a button, or so I could get
it run run automatically when calculations change.....

Sounds simple enough, but hours of searching the web have drawn a
blank...

Thanks.