View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default conditional format problem

can anyone explain to me why this happens in this code?

Set rng = Range("B8:f" & tblRows)
With rng
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$D8$D$" & tblRows + 1
End With

tblrows = 31 so the expression equates to =$D8$D$32

but the equation in row 8 is =$D9$D$32. each row is off by one.

the operation before this is a copy to f7:f31 and it's still selected, so i
am guessing this is throwing it off

if i do a selection of a single cell, it appears to enter the formula ok.
any way around this without selecting a cell?
--


Gary