PDA

View Full Version : retaining conditional formatting with advanced filter



zest1
04-07-2006, 04:07 PM
hi,

running advanced filter over conditionally-formatted cells erases the conditions set for those cells. Is there some simple vba code that I can insert into my advanced filter code to retain (or reactivate) the conditional formatting after running AdvFltr?

Bob Phillips
04-08-2006, 02:31 AM
Avanced filter doesn't in itself remove the CF, but I agree it does if you also copy the filtered data somewhere else (although oddly not for the header!).

Is this what you are doing? The only solution I could see to that is VBA to do the filter then re-apply the CF.

zest1
04-08-2006, 08:36 AM
with Advanced Filter, I'm copying to another set of cells which I have conditionally formatted, but whenever I run the Adv. Fltr., the CF'g is lost and I have to go in and set it all up again.

There must be some way to retain the CF'g, or at least incorporate it into, or with, the AdvF code so that running the Adv.F also runs the CF'g and automatically sets it up again without having to do it manually each time.

Bob Phillips
04-08-2006, 11:23 AM
As I said VBA. Is that acceptable?

zest1
04-08-2006, 11:59 AM
Hi XDL,

yes VBA would be perfect!

malik641
04-08-2006, 12:03 PM
Avanced filter doesn't in itself remove the CF, but I agree it does if you also copy the filtered data somewhere else (although oddly not for the header!).

Is this what you are doing? The only solution I could see to that is VBA to do the filter then re-apply the CF. Why bother re-applying the CF? Why can't we just have VB code do the AdvF and then use VB code to perform a paste special (values only) to the desired destination? Instead of letting the AdvF perform the copy-paste procedure?

zest1
04-08-2006, 12:10 PM
I'm using AdvFltr to select a specific range of dates (from a larger range), and then applying CF'g to highlight the dates meeting certain criteria, so that I can easily distinguish between the various data.

zest1
04-10-2006, 10:42 AM
So then, what is the VBA syntax to apply CF'g to a filtered list? I'm just simply trying to highlight each row/ranges based on the value in 1 cell/column in those row.

Thus, if that cell's value = "E", then highlight that row/range cells with one color, else if that cell's value = "X", then highlight with another color, else if that cell's value = "L", then use another color.

Thanks