vba - Excel: Conditional Formatting by Row Header and not Row Number -


i need highlight values between 1 , 30 across 150 tabs in specific row. row fluctuates between row 6, row 7, row 8 , row 9 between each tab, trying row header named total. possible?

the op has posted in comments wants apply conditional formatting row 6 in of worksheets, , not various rows might contain word total. this, in excel 2007

apply desired conditional formatting row 6 on single sheet. select entire row  select format painter  navigate next sheet select of sheets wish cf row 6 select row 6 (click on 6 format painter) 

while cannot cf multiple sheets @ same time in excel 2007, can cf single sheet, , copy format multiple sheets simultaneously.

edit: see have recorded macro produce conditional formatting , pasted 1 of comments.

the next step modify find word total in 1 of rows 6:8, , apply formatting row.

here modification of posted, should every sheet. cleaned code macro recorder produced. note macro assumes row header in first column (column a). cycles through each worksheet , applies formatting relevant row in range.

in addition, , may or may not desired, macro removes conditional formatting other cells in rows.

give try:

option explicit sub macro1()     dim r range, c range     dim ws worksheet  each ws in thisworkbook.worksheets     set r = ws.rows("6:8")         r.formatconditions.delete  'get rid of old formatconditions     r.columns(1)         set c = .find(what:="total", lookin:=xlvalues, _             lookat:=xlwhole, matchcase:=false)     end     if not c nothing         c.entirerow             .formatconditions.add _                 type:=xlcellvalue, _                 operator:=xlbetween, _                 formula1:="=1.0000001", _                 formula2:="=30"             .formatconditions(1).interior                 .patterncolorindex = xlautomatic                 .color = 13551615                 .tintandshade = 0             end             .formatconditions(1).stopiftrue = false         end     end if next ws end sub 

edit: op wants range of 0 30, exclude empty cells. alter cf formula (expression) test there number in cell:

option explicit sub macro1()     dim r range, c range     dim ws worksheet  each ws in thisworkbook.worksheets     set r = ws.rows("6:8")         r.formatconditions.delete  'get rid of old formatconditions     r.columns(1)         set c = .find(what:="total", lookin:=xlvalues, _             lookat:=xlwhole, matchcase:=false)     end     if not c nothing         c.entirerow             .formatconditions.add _                 type:=xlexpression, _                 formula1:="=and(isnumber(" & c.address(true, false) & "), " & _                     c.address(true, false) & ">=0, " & _                     c.address(true, false) & "<=30)"             .formatconditions(1).interior                 .patterncolorindex = xlautomatic                 .color = 13551615                 .tintandshade = 0             end         end     end if next ws end sub 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -