excel vba - Need to bold cells where the formula result is greater than or equal to 10 via VBA -


i need apply bold cells within range formula result 10 or more. i've tried following code seems apply bold randomly!

sub boldhighhours()  application.screenupdating = false dim c object  each c in range("i7:am1005")    if c.value >= 10        c.offset(0, 1).font.bold = true        c.offset(0, 2).font.bold = true    else        c.offset(0, 1).font.bold = false        c.offset(0, 2).font.bold = false    end if next application.screenupdating = true end sub 

if you've been following previous questions/saga you'll understand why can't use conditional formatting! autofilter doth not kindly upon large amounts of conditional formatting , punishes ye slowdown greatly!

you need remove offset():

sub boldhighhours()      application.screenupdating = false      dim c range       each c in range("i7:am1005")           if c.value >= 10              c.font.bold = true         else              c.font.bold = false          end if       next      application.screenupdating = true   end sub 

my optimisation:

sub boldhighhours()      application.screenupdating = false      dim c long      each c = 9 39 ' am..          activesheet.autofiltermode = false          range("a8:a1005").offset(0, c - 1)              .font.bold = false             .autofilter field:=1, criteria1:=">=10"             .font.bold = true         end       next       activesheet.autofiltermode = false     application.screenupdating = true   end sub 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -