excel - Access VBA - condition formatting with 2 different xlFormatCondictionTypes -
i condition formatting while exporting access excel. have check condition 1(type:=xlexpression) , condition 2(type:=xltextstring). if both true, highlight row color in excel. here code:
with xlsheet set range = .range("a1:l1") sheets("xyz").select range.formatconditions.add type:=xlexpression, formula1:="=and($i1>=today(),($i1<(today()+30)))" rng.formatconditions.add type:=xltextstring, string:="focus", textoperator:=xlcontains rng.formatconditions(1).interior .color = color end end how combine above 2 conditions 1 condition.
thanks,
the code in post bit on place in areas, assumptions on fixes may bit off. however, things can adjust easily.
as far combining conditions, place formula inside and wrapper of current expression.
with xlsheet set range = .range("a1:l1") range.formatconditions.add type:=xlexpression, formula1:="=and($i1>=today(),($i1<(today()+30),not(iserror(find(""focus"",$i1))))" range.formatconditions(1).interior .color = color end end
Comments
Post a Comment