excel - vba looking for a fast way to highlight every other row -


so far have , it's slow big data sets.

'for every row in current selection... counter = 1 rng.rows.count 'reccnt     'if row odd number (within selection)...     if counter mod 2 = 1         rng.rows(counter).interior                 .pattern = xlsolid                 .patterncolorindex = xlautomatic                 .themecolor = xlthemecoloraccent6                 .tintandshade = 0.799981688894314                 .patterntintandshade = 0         end     end if next 

give try. imagine speed things bit. runs me instantly.

sub coloreven()     set rng = rows("1:40000")     rng.formatconditions.add type:=xlexpression, formula1:="=mod(row(),2)=0"     rng.formatconditions(1).interior.pattern = xlsolid     rng.formatconditions(1).interior.patterncolorindex = xlautomatic     rng.formatconditions(1).interior.themecolor = xlthemecoloraccent6     rng.formatconditions(1).interior.tintandshade = 0.799981688894314     rng.formatconditions(1).interior.patterntintandshade = 0 end sub 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -