Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter Problem - show column difference
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter Problem - show column difference
On 13 Jun, 17:49, JW wrote:
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 programmedfilterwhich shows only those rows where thecolumnJ 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.- Hide quoted text - - Show quoted text - Thanks. That works a treat! But it's a bit slooow. Any ideas on speeding it up? Cheers |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Fields show in one column problem | Excel Programming | |||
Fields show in one column problem | Excel Programming | |||
Auto Filter does not show all the data in the column | Excel Worksheet Functions | |||
filter of column problem | Excel Programming | |||
add a column to a pivot table that would show the difference between 2 other Columns | Excel Worksheet Functions |