Office中国论坛/Access中国论坛

标题: excel里满足某条件自动变色,可以吗 [打印本页]

作者: hsilence    时间: 2006-3-4 17:31
标题: excel里满足某条件自动变色,可以吗
excel里,当某条记录,比如说今日进货,当他大于某个数字时,显示红色,怎么操作?望指点




作者: Bluelost    时间: 2006-3-11 23:14
试试下面这些代码

Private Sub Worksheet_Deactivate()

for i = 1 to 10000

if cells(i,2).value="" then

exit sub

end if

if cells(i,2).value>cells(1,1).value then

cells(i,2).Interior.ColorIndex = 3

else cells(i,2).Interior.ColorIndex = xlNone

end if

next

'其中cells(1,1)为被比较的单元格,可以自由改动.

'cells(i,2)是数据列

End Sub

[此贴子已经被作者于2006-3-13 8:23:55编辑过]


作者: 拥有快乐    时间: 2006-3-16 02:24
这么麻烦吗,不用编程的话,格式--条件格式- 就完全搞定了,
作者: 布衣铁剑    时间: 2006-3-16 09:22
二楼说的极是。

条件格式-->大于 X 则变色。
作者: wktt6833    时间: 2006-9-12 07:17
格式--条件格式,选中区域,再设定条件
作者: 红池坝    时间: 2006-9-12 16:40
呵呵,条件格式是正解
作者: LANPP    时间: 2006-9-13 22:05
这个条件怎么设定
作者: pureshadow    时间: 2006-9-14 05:17
条件格式的问题在于,只能设三个条件,如果要设三个以上的条件,恐怕还是要VBA吧,吼吼。。。。
作者: ywz168    时间: 2006-9-18 00:28
条件格式怎么做
作者: heusinger    时间: 2006-9-21 01:53
好象必须得用VBA来做
作者: jack-ice    时间: 2006-9-23 06:53
学习中
作者: nodoom    时间: 2006-10-15 08:31
各位,我查过,一本叫做宝典的书,它上面说,这个程序不可能用VBA完成




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3