excel vba - Set conditional formatting expression using VBA variables? -


i trying add conditional formatting range vba using following statement:

r.formatconditions.add type:=xlexpression, formula1:="=and($ayq4<=d$3;$ayr4>=d$3)" 

now problem instead of having ayq, 4, d, 3 , ayr have following vba variables:

ldatesandheadersrow = 3 first row of range r = 4  first column of range r = d lstartdatecol = column number of ayq lenddatecol = column number of ayr 

is there way me use vba variables instead of normal cell references in following expression formula1:="=and($ayq4<=d$3;$ayr4>=d$3)"?

no, cannot. variables exists in context of macro defined into, once copied in cell become strings.


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -