根据约束着色单元格(Coloring cell according to constraints)

编程入门 行业动态 更新时间:2024-10-24 04:38:27
根据约束着色单元格(Coloring cell according to constraints)

是否可以使用一些简单的约束着色单元格(对于这些我假设列没有字母而是数字):

Statring单元格(x0,y0)和结束单元格(x1,y1) 细胞必须满足等式(x,2x)

例如,我选择单元格begin(1,1)和end(10,10)着色应该发生在(1,1)(2,3)(3,5)(4,7)(5,9),那就是它因为(6,11)将超出y。

如果有可能你能告诉我它是如何做到的?

Is it possible to coloring cells using some simple constraints (for these I assume columns don't have letters but numbers):

Statring cell (x0, y0) and ending cell (x1, y1) Cells must fulfill equation (x, 2x)

For instance I select cell begin (1,1) and end (10, 10) Coloring should happens to (1,1) (2,3) (3,5) (4,7) (5,9) and that's it since (6,11) would go out of bound for y.

If it's possible could you tell me how it can be done?

最满意答案

非常简单的宏将完成此任务:

Dim i As Integer For i = 1 To 100 'Instead of 100, put your upper number here. With Cells(i, i * 2).Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorLight2 .TintAndShade = -0.249977111117893 .PatternTintAndShade = 0 End With Next

Very simple macro will accomplish this:

Dim i As Integer For i = 1 To 100 'Instead of 100, put your upper number here. With Cells(i, i * 2).Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorLight2 .TintAndShade = -0.249977111117893 .PatternTintAndShade = 0 End With Next

更多推荐

本文发布于:2023-07-17 07:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1141165.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元格   Coloring   constraints   cell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!