excel - Conditional formatting error -


i'm trying write vba code adds conditional formatting sheet, keep running application defined error. following code

with sheet1.range("c2:c")   .formatconditions.delete   .formatconditions.add type:=xlexpression, formula1:="=not(isblank($b2))"   .formatconditions(1).interior.colorindex = rgb(225, 242, 255) end 

any suggestions on why happening?

thanks!

range("c2:c") not valid range, make fixed, or following makes dynamic:

then change colorindex color:

with range("c2:c" & cells(rows.count, "c").end(xlup).row)   .formatconditions.delete   .formatconditions.add type:=xlexpression, formula1:="=not(isblank($b2))"   .formatconditions(1).interior.color = rgb(225, 242, 255) end 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -