我有一个像这样的 Excel 电子表格
id | data for id | more data for id id | data for id id | data for id | more data for id | even more data for id id | data for id | more data for id id | data for id id | data for id | more data for id
现在我想通过交替行的背景颜色来对一个id的数据进行分组
var color = white for each row if the first cell is not empty and color is white set color to green if the first cell is not empty and color is green set color to white set background of row to color
任何人都可以帮我编写宏或一些 VBA 代码吗
谢谢
最佳答案
我使用此公式来获取条件格式的输入:
=IF(B2=B1,E1,1-E1)) [content of cell E2]
其中B列包含需要分组的项目,E是辅助列。每当上部单元格(本例中为 B1)与当前单元格 (B2) 相同时,就会返回 E 列的上部行内容。否则,它将返回 1 减去该内容(即输出将为 0 或 1,具体取决于上面单元格的值)。
关于excel - 在 Excel 中交替着色行组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27020/