P panwen Unregistered / Unconfirmed GUEST, unregistred user! 2006-04-28 #1 我想根据EXCEL中某个单元格的内容来控制该单元格的格式,比如单元格里的内容为“Y”,那么该单元格的填充颜色为绿色,如果内容为“N”,则填充颜色为红色。大家帮帮忙!
O ohayoo Unregistered / Unconfirmed GUEST, unregistred user! 2006-04-28 #2 Range("C5".Select Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:="=""Y""" Selection.FormatConditions(1).Font.ColorIndex = 3 Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:="=""N""" Selection.FormatConditions(2).Font.ColorIndex = 10 这句是VB语法,将其改成DELPHI的语法应用在你的程序里。
Range("C5".Select Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:="=""Y""" Selection.FormatConditions(1).Font.ColorIndex = 3 Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:="=""N""" Selection.FormatConditions(2).Font.ColorIndex = 10 这句是VB语法,将其改成DELPHI的语法应用在你的程序里。
Z zyt_1978 Unregistered / Unconfirmed GUEST, unregistred user! 2006-04-28 #3 if myexcel.cells[12,12].value="y" then 填充颜色还不知道