如何提取数据透视表中特定颜色的单元格?

问题描述 投票:0回答:1

我已对 Excel 中的数据透视表的列应用了条件格式,它会自动将大于特定值的单元格着色为红色。

我还想将这些红细胞分别提取到同一张纸中的特定区域。

可以通过使用宏来完成吗?或者“if”条件在这里会有帮助吗?

excel vba if-statement pivot-table conditional-formatting
1个回答
0
投票

您的条件格式参数是什么?您可以通过编程方式使用相同的逻辑。或者,您可以编写代码来检查单元格的颜色。

'specify the cell you want the color for
x = InputBox("what cell")
Range("a1") = Range(x).Interior.Color


If Range(x).Interior.Color = Range("a1") Then
MsgBox "yes the color is right"
End If

数据透视表示例

'where cell is something your looking for that is in the cell
 ActiveSheet.PivotTables("PivotTable1").PivotSelect "'cell'", xlDataAndLabel + xlFirstRow, True
 x = Selection.Interior.Color
© www.soinside.com 2019 - 2024. All rights reserved.