in reply to excel conditional formatting

This probably wil not be doing what you want:
$WS->Cells($i,11)->FormatConditions->Add(xlExpression,, "=AND(J$i>0,K$i=0)");
I'm talking about the 2 commas in a row. Perl ignores extra commas.

Try

$WS->Cells($i,11)->FormatConditions->Add(xlExpression, undef, "=AND(J$i>0,K$i=0)");
(untested)

Replies are listed 'Best First'.
Re^2: excel conditional formatting
by ArtYaffe (Novice) on Sep 10, 2009 at 16:04 UTC
    Thanks, Bart. That helped.I now get a conditional format, but the "=AND(J$i>0,K$i=0)" has been corrupted. With $i =11, I get "=AND(T21>0,U21=0)".
      Thanks, Bart, for your help. 'undef' in the second position is necessary. However, this method does something "relative", so I had to add dollar signs to the formula. Also, although I have 'use Win32::OLE::Const "Microsoft Excel";' in the code, xlYellow didn't work; I substituted '6'.
      $WS->Cells($i,11)->FormatConditions->Add (xlExpression,undef,"=AND(\$J\$$i>0,\$K\$$i=0)"); $WS->Cells($i,11)->FormatConditions(1)->Interior-> {ColorIndex} = 6; #xlYellow
      Problem solved. Thanks for everyone who chimed in.