如何根据下拉列表菜单更改颜色填充单元格?

How to change the colour fill the cell based in the drop list menu?

我找到了如何从 excel 2016 年的列表中获取所选名称的最后一次出现。问题是我想 "highlight" 或更改单元格的颜色填充当我在列表中选择它的名称时,它就在标准中。

这是我的代码:

=PROC(2;1/(C1:C199=P61);A1:A199)

在我的电子表格中,名称位于 'C' 列,数据位于 A 列。

我只需要知道如何像下图那样改变颜色。下拉列表名称和数据代码我知道怎么做。

图片的

Link:enter link description here

谢谢。

您可以通过将 Conditional Formatting 应用于所需范围来实现。

确保 select Range("A2:B15"),然后转到:

Home > Conditional Formatting > New rule > Use a Formula to determine which cells to format

写下这个公式,然后选择格式:

=COUNTIFS($A2;$D;$B2;$E)>0

单击 OK,然后单击 Apply