excel - Override Conditional Formatting with Worksheet_SelectionChange -


i have code in worksheet highlight row of selected cell. however, sheet has conditional formatting colours of rows. highlighting macro not work on rows formatting condition being met (in sense colour of highlight not overriding colour of conditional formatting).

private sub worksheet_selectionchange(byval target range)     cells.interior.colorindex = xlcolorindexnone      activecell.entirerow.interior.colorindex = 19 'highlight row end sub 

does know way around without removing conditional formatting? eg. can temporarily disable selected row , re-enable when row unselected?

the formatting 1 rule applied cells. figure in theory create independent rule every row (~500 of them) , turn off , later reapply seems little overboard.

there no need use activecell in worksheet_selectionchange event macro. target is/does.

modify worksheet_selectionchange closer following.

private sub worksheet_selectionchange(byval target range)     target.name = "myselection"     cells.interior.pattern = xlnone     target.entirerow.interior.colorindex = 19 end sub 

now redefining named range each new selection of cells.

you didn't disclose cf rule i'm going assume highlights cell not blank. modify existing cf rule of use formula determine cells format variety , adjust following suit own cf rule put in format values formula true: text box.

=and(a1<>"", row(a1)<>row(myselection)) 

by adding boolean criteria within , function , redefining myselection range current selection can override cf rule's formatting.

        conditional formatting override


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -