根据约束着色单元格
是否有可能使用一些简单的约束来着色单元格(对于这些我假设列没有字母,但数字):
- Statring单元格(x0,y0)和结束单元格(x1,y1)
- 细胞必须满足方程(x,2x)
例如,我select单元格开始(1,1)和结束(10,10)着色应该发生在(1,1)(2,3)(3,5)(4,7)(5,9),就是这样因为(6,11)会跳出y。
如果有可能,你能告诉我怎么做?
非常简单的macros将实现这一点:
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
使用像这样的公式的条件格式 :
=ROW()*2=COLUMN()+1