读书人

excel 宏 VBA 填充背景色解决方法

发布时间: 2012-02-10 21:27:41 作者: rapoo

excel 宏 VBA 填充背景色
ABCDEF
1Cc12Cc13Cc14Cc15Cc16
2Cc13背景色
3Cc15背景色背景色背景色

需要A列的所有单元格同B1,C1,D1,E1,F1比较。
例如B1单元格(数据是Cc12) 小于A2(Cc13),即12<13.
所以B2单元格填充背景色。
其它比较下来小于A列的所有单元格都填充上背景色。
请教高人!
excel 宏 VBA 填充背景色



[解决办法]
去 开发语言→office开发/VBA 版块
[解决办法]

SQL code
/*A B C D E F1 Cc12 Cc13 Cc14 Cc15 Cc162 Cc13 背景色3 Cc15 背景色 背景色 背景色 */declare @b int    --字段的数据类型,用int为例!declare @c intdeclare @d intdeclare @e intdeclare @f intdeclare @beijing int  --背景色select @b = b,@c = c,@d = d,@e = e,@f = f from tb where a = 1update tbset b = (case when b < @b then @beijing else b end),    c = (case when c < @c then @beijing else c end),    d = (case when d < @d then @beijing else d end),    e = (case when e < @e then @beijing else e end),    f = (case when f < @f then @beijing else f end)where a > 1
[解决办法]
没看明白 A2为啥是CC13
[解决办法]
你是要宏还是要SQL?
[解决办法]
发错地方了。
[解决办法]
excel 宏 不会。。。
[解决办法]
探讨
据我观察没人会

或许高手懒得出手,多顶顶帖吧

[解决办法]
http://topic.csdn.net/u/20070821/07/985327ac-ff56-40d8-adec-a45897317a36.html

http://office.microsoft.com/zh-cn/excel-help/HA001136627.aspx

我感觉这俩一结合就差不多了,你比我聪明你肯定能看懂

我觉得我都快看懂了
[解决办法]
VB.NET code
 主要还是几个函数的问题If   Range( "h4 ").Value   >   0.01   And   Range( "h4 ").Value   <   0.02   Then           x   =   Range( "h4 ").Value   -   0.01           Range( "c4 ").Value   =   Int((1   -   Range(h4).Value   -   Range( "g4 ").Value)   *   Range( "b4 ").Value) Range("A1:A6").Interior.Color = RGB(200,160,35) 

读书人网 >VB

热点推荐