excel - conditional formatting and vba -


in macro using following code:

with range("t2:x31")     .formatconditions.delete     .formatconditions.add type:=xlexpression, formula1:="=$r2=0"     .formatconditions.add type:=xlexpression, formula1:="=$ae2"     .formatconditions.add type:=xlexpression, formula1:="=$af2"     .formatconditions(1).interior.color = rgb(216, 216, 216)     .formatconditions(1).font.color = rgb(216, 216, 216)     .formatconditions(2).interior.color = rgb(255, 40, 40)     .formatconditions(2).font.color = rgb(255, 255, 255)     .formatconditions(3).interior.color = rgb(255, 128, 0)     .formatconditions(3).font.color = rgb(0, 0, 0) end 

what in excel when check conditional formatting rules (entered manually):

enter image description here

what instead is

enter image description here

where ok except row (1046053 instead of 2). how should enter cell reference right formula.

try select a2 before set conditions:

range("a2").select 

i never used vba, have suspicion formulas in conditional formatting related current selection.

i think it's better select range set conditions for, interface:

range("t2:x31").select 

Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -