Microsoft Excel can not be recorded against directly QTP. If you want to automate testing you will have to use VB scripting level calls.
IF I understand, you are looking for code to implement code to set the colors of the cell by the value of the contents of the cell. I have written some code that will cell formatting on conditional settings. Here are the conditional settings.
* If cell value is less than 0 set cell color to red.
* If cell value is between 0 and 10 then set the cell color to yellow.
* If cell value over 10 set cell color to green.
Here is my code.
Dim oExcel
Dim oBook
Dim oSheet
Dim oFc
Dim oRange
const xlCellValue = 1
const xlGreater = 5
Const xlNotEqual=4
Const xlEqual=3
Const xlNotBetween=2
Const xlLess=6
Const xlGreaterEqual=7
Const xlLessEqual=8
Const xlBetween=1
aSampleFile=''C:TempTestfile.xls''
Set oExcel = CreateObject(''Excel.Application'')
Set oBook = oExcel.Workbooks.Open(aSampleFile)
oExcel.Visible =true
Set oRange = oExcel.Range(''B2:B5'')
oRange.FormatConditions.Delete
Set oFc = oRange.FormatConditions.Add(xlCellValue, xlLess, ''0'' )
'Red
oFc.Interior.ColorIndex = 3
Set oFc = oRange.FormatConditions.Add (xlCellValue, xlBetween, ''0'', ''10'')
'yellow
oFc.Interior.ColorIndex = 6
Set oFc = oRange.FormatConditions.Add (xlCellValue, xlGreater, ''10'')
'Green
oFc.Interior.ColorIndex = 4
Set oFc =nothing
Set oRange=nothing
Set oSheet =nothing
Set oBook =nothing
Set oExcel =nothing