Excel 2010 - 单元格和形状着色 - 我的想法
Excel 2003 有一个简单的 ...interior.colorindex 并且只有 56 个数字。但是,Excel 2010 对此进行了更改,以实现更好的控制。
现在,在开发一个程序时..应该复制单元格颜色(在VBA中)并根据单元格内容将单元格的相同颜色放入Excel形状...我迷失了几个不同的对象,如下所示
:单元格:
Sheets("Config").Range("E1").Interior.ThemeColor = 10
Sheets("Config").Range("E1").Interior.TintAndShade = -0.249977111117893
对于形状:
Activesheet.shapes("R3").fill.forecolor.objectthemecolor = 7
Activesheet.shapes("R3").fill.forecolor.brightness = 0.6
Activesheet.shapes("R3").fill.forecolor.schemecolor = 42
Activesheet.shapes("R3").fill.forecolor.tintandshade (and this doesn't even work)
Excel 2003 had a simple ...interior.colorindex and only 56 numbers. But, this is changed with Excel 2010 for better control.
Now while developing a program.. which is supposed to copy a cell color (in VBA) and put the same color of the cell to an Excel Shape depending on the cell contents... i was lost with several different objects like this:
For the Cell:
Sheets("Config").Range("E1").Interior.ThemeColor = 10
Sheets("Config").Range("E1").Interior.TintAndShade = -0.249977111117893
For the Shape:
Activesheet.shapes("R3").fill.forecolor.objectthemecolor = 7
Activesheet.shapes("R3").fill.forecolor.brightness = 0.6
Activesheet.shapes("R3").fill.forecolor.schemecolor = 42
Activesheet.shapes("R3").fill.forecolor.tintandshade (and this doesn't even work)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一种更好更简单的方法,不需要上述所有不同的命名。
您所需要的是:
它将返回一个长...,例如:682978(十进制的十六进制颜色)
并且,您可以设置形状的颜色,如下所示:
其他有用的注释是:
和,用于在控制台中打印
I have found a better simpler way which don't require all the above different naming..
All you need is:
which will return a long... like this for example: 682978 (of the hex color in decimal)
And, you can set the color for the shape like this:
Other useful notes are:
and, for printing in console