>>Thanks a lot for your response. I put TOTAL in the first column at the very bottom. The mentioned code works fine in Excel 2003, >>but does nothing in Excel 2007.
>>How exactly do you suggest me to adjust it?
Naomi,
I've not used xlLastCell before, but as far as I can see in 2007 at least it is only return a selection to the last cell that has a value assigned, therefore in an empty column it only selects and assigns the FormatCondition to cell A1.
If you change your selection line as below it seems to work fine.
loExcel.Columns("A:A").SELECT
loExcel.SELECTION.FormatConditions.DELETE
loExcel.SELECTION.FormatConditions.ADD(xlExpression,, '=UPPER(Left($A1,5))="TOTAL"')
WITH loExcel.SELECTION.FormatConditions(1)
.FONT.Bold = .T.
.Interior.ColorIndex = 4
ENDWITH
Regards
Gary.